OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library SVGElementTest; | 5 library SVGElementTest; |
6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:svg'; | 9 import 'dart:svg'; |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 testConstructor('text', (e) => e is SVGTextElement); | 145 testConstructor('text', (e) => e is SVGTextElement); |
146 testConstructor('textPath', (e) => e is SVGTextPathElement); | 146 testConstructor('textPath', (e) => e is SVGTextPathElement); |
147 testConstructor('title', (e) => e is SVGTitleElement); | 147 testConstructor('title', (e) => e is SVGTitleElement); |
148 testConstructor('use', (e) => e is SVGUseElement); | 148 testConstructor('use', (e) => e is SVGUseElement); |
149 testConstructor('view', (e) => e is SVGViewElement); | 149 testConstructor('view', (e) => e is SVGViewElement); |
150 }); | 150 }); |
151 | 151 |
152 group('outerHTML', () { | 152 group('outerHTML', () { |
153 test('outerHTML', () { | 153 test('outerHTML', () { |
154 final el = new SVGSVGElement(); | 154 final el = new SVGSVGElement(); |
155 el.elements.add(new SVGElement.tag("circle")); | 155 el.elements.add(new SVGCircleElement()); |
156 el.elements.add(new SVGElement.tag("path")); | 156 el.elements.add(new SVGPathElement()); |
157 expect(el.outerHTML, | 157 expect(el.outerHTML, |
158 '<svg version="1.1"><circle></circle><path></path></svg>'); | 158 '<svg version="1.1"><circle></circle><path></path></svg>'); |
159 }); | 159 }); |
160 }); | 160 }); |
161 | 161 |
162 group('innerHTML', () { | 162 group('innerHTML', () { |
163 test('get', () { | 163 test('get', () { |
164 final el = new SVGSVGElement(); | 164 final el = new SVGSVGElement(); |
165 el.elements.add(new SVGElement.tag("circle")); | 165 el.elements.add(new SVGCircleElement()); |
166 el.elements.add(new SVGElement.tag("path")); | 166 el.elements.add(new SVGPathElement()); |
167 expect(el.innerHTML, '<circle></circle><path></path>'); | 167 expect(el.innerHTML, '<circle></circle><path></path>'); |
168 }); | 168 }); |
169 | 169 |
170 test('set', () { | 170 test('set', () { |
171 final el = new SVGSVGElement(); | 171 final el = new SVGSVGElement(); |
172 el.elements.add(new SVGElement.tag("circle")); | 172 el.elements.add(new SVGCircleElement()); |
173 el.elements.add(new SVGElement.tag("path")); | 173 el.elements.add(new SVGPathElement()); |
174 el.innerHTML = '<rect></rect><a></a>'; | 174 el.innerHTML = '<rect></rect><a></a>'; |
175 expect(_nodeStrings(el.elements), ["rect", "a"]); | 175 expect(_nodeStrings(el.elements), ["rect", "a"]); |
176 }); | 176 }); |
177 }); | 177 }); |
178 | 178 |
179 group('elementget', () { | 179 group('elementget', () { |
180 test('get', () { | 180 test('get', () { |
181 final el = new SVGElement.svg(""" | 181 final el = new SVGElement.svg(""" |
182 <svg version="1.1"> | 182 <svg version="1.1"> |
183 <circle></circle> | 183 <circle></circle> |
(...skipping 17 matching lines...) Expand all Loading... |
201 var el = new SVGElement.tag("circle"); | 201 var el = new SVGElement.tag("circle"); |
202 var classes = el.classes; | 202 var classes = el.classes; |
203 expect(el.classes.length, 0); | 203 expect(el.classes.length, 0); |
204 classes.toggle('foo'); | 204 classes.toggle('foo'); |
205 expect(el.classes.length, 1); | 205 expect(el.classes.length, 1); |
206 classes.toggle('foo'); | 206 classes.toggle('foo'); |
207 expect(el.classes.length, 0); | 207 expect(el.classes.length, 0); |
208 }); | 208 }); |
209 }); | 209 }); |
210 } | 210 } |
OLD | NEW |