| 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' as svg; | 9 import 'dart:svg' as svg; |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 group('elementget', () { | 179 group('elementget', () { |
| 180 test('get', () { | 180 test('get', () { |
| 181 final el = new svg.SvgElement.svg(""" | 181 final el = new svg.SvgElement.svg(""" |
| 182 <svg version="1.1"> | 182 <svg version="1.1"> |
| 183 <circle></circle> | 183 <circle></circle> |
| 184 <path></path> | 184 <path></path> |
| 185 text | 185 text |
| 186 </svg>"""); | 186 </svg>"""); |
| 187 expect(_nodeStrings(el.children), ["circle", "path"]); | 187 expect(_nodeStrings(el.children), ["circle", "path"]); |
| 188 }); | 188 }); |
| 189 |
| 190 test('resize', () { |
| 191 var el = new svg.SvgSvgElement(); |
| 192 var items = [new svg.CircleElement(), new svg.RectElement()]; |
| 193 el.children = items; |
| 194 expect(el.children.length, 2); |
| 195 el.children.length = 1; |
| 196 expect(el.children.length, 1); |
| 197 expect(el.children.contains(items[0]), true); |
| 198 expect(el.children.contains(items[1]), false); |
| 199 |
| 200 el.children.length = 0; |
| 201 expect(el.children.contains(items[0]), false); |
| 202 }); |
| 189 }); | 203 }); |
| 190 | 204 |
| 191 group('elementset', () { | 205 group('elementset', () { |
| 192 test('set', () { | 206 test('set', () { |
| 193 final el = new svg.SvgSvgElement(); | 207 final el = new svg.SvgSvgElement(); |
| 194 el.children = [new svg.SvgElement.tag("circle"), new svg.SvgElement.tag("p
ath")]; | 208 el.children = [new svg.SvgElement.tag("circle"), new svg.SvgElement.tag("p
ath")]; |
| 195 expect(el.innerHtml, '<circle></circle><path></path>'); | 209 expect(el.innerHtml, '<circle></circle><path></path>'); |
| 196 }); | 210 }); |
| 197 }); | 211 }); |
| 198 | 212 |
| 199 group('css', () { | 213 group('css', () { |
| 200 test('classes', () { | 214 test('classes', () { |
| 201 var el = new svg.CircleElement(); | 215 var el = new svg.CircleElement(); |
| 202 var classes = el.classes; | 216 var classes = el.classes; |
| 203 expect(el.classes.length, 0); | 217 expect(el.classes.length, 0); |
| 204 classes.toggle('foo'); | 218 classes.toggle('foo'); |
| 205 expect(el.classes.length, 1); | 219 expect(el.classes.length, 1); |
| 206 classes.toggle('foo'); | 220 classes.toggle('foo'); |
| 207 expect(el.classes.length, 0); | 221 expect(el.classes.length, 0); |
| 208 }); | 222 }); |
| 209 }); | 223 }); |
| 210 } | 224 } |
| OLD | NEW |