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 'dart:html'; | 6 import 'dart:html'; |
7 import 'dart:svg' as svg; | 7 import 'dart:svg' as svg; |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 import 'package:unittest/html_individual_config.dart'; | 9 import 'package:unittest/html_individual_config.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 return out; | 28 return out; |
29 }; | 29 }; |
30 | 30 |
31 testConstructor(String tagName, Function isExpectedClass, | 31 testConstructor(String tagName, Function isExpectedClass, |
32 [bool expectation = true, allowsInnerHtml = true]) { | 32 [bool expectation = true, allowsInnerHtml = true]) { |
33 test(tagName, () { | 33 test(tagName, () { |
34 expect(isExpectedClass(new svg.SvgElement.tag(tagName)), expectation); | 34 expect(isExpectedClass(new svg.SvgElement.tag(tagName)), expectation); |
35 if (allowsInnerHtml) { | 35 if (allowsInnerHtml) { |
36 expect(isExpectedClass(new svg.SvgElement.svg('<$tagName></$tagName>')), | 36 expect(isExpectedClass(new svg.SvgElement.svg('<$tagName></$tagName>')), |
37 allowsInnerHtml); | 37 expectation && allowsInnerHtml); |
38 } | 38 } |
39 }); | 39 }); |
40 } | 40 } |
41 group('additionalConstructors', () { | 41 group('additionalConstructors', () { |
42 test('valid', () { | 42 test('valid', () { |
43 final svgContent = """ | 43 final svgContent = """ |
44 <svg version="1.1"> | 44 <svg version="1.1"> |
45 <circle></circle> | 45 <circle></circle> |
46 <path></path> | 46 <path></path> |
47 </svg>"""; | 47 </svg>"""; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 group('PathElement', () { | 446 group('PathElement', () { |
447 test('pathSegList', () { | 447 test('pathSegList', () { |
448 svg.PathElement path = | 448 svg.PathElement path = |
449 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); | 449 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); |
450 for (var seg in path.pathSegList) { | 450 for (var seg in path.pathSegList) { |
451 expect(seg is svg.PathSeg, isTrue); | 451 expect(seg is svg.PathSeg, isTrue); |
452 } | 452 } |
453 }); | 453 }); |
454 }); | 454 }); |
455 } | 455 } |
OLD | NEW |