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 22 matching lines...) Expand all Loading... |
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 expectation && 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\">\n" |
45 <circle></circle> | 45 " <circle></circle>\n" |
46 <path></path> | 46 " <path></path>\n" |
47 </svg>"""; | 47 "</svg>"; |
48 final el = new svg.SvgElement.svg(svgContent); | 48 final el = new svg.SvgElement.svg(svgContent); |
49 expect(el, isSvgSvgElement); | 49 expect(el, isSvgSvgElement); |
50 expect(el.innerHtml, anyOf("<circle></circle><path></path>", '<circle ' | 50 expect(el.innerHtml, anyOf("<circle></circle><path></path>", '<circle ' |
51 'xmlns="http://www.w3.org/2000/svg" /><path ' | 51 'xmlns="http://www.w3.org/2000/svg" /><path ' |
52 'xmlns="http://www.w3.org/2000/svg" />')); | 52 'xmlns="http://www.w3.org/2000/svg" />')); |
53 expect(el.outerHtml, anyOf(svgContent, | 53 expect(el.outerHtml, anyOf(svgContent, |
54 '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">\n ' | 54 '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">\n ' |
55 '<circle />\n <path />\n</svg>', | 55 '<circle />\n <path />\n</svg>')); |
56 '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">\r\n ' | |
57 '<circle />\r\n <path />\r\n</svg>')); | |
58 }); | 56 }); |
59 | 57 |
60 test('has no parent', () => | 58 test('has no parent', () => |
61 expect(new svg.SvgElement.svg('<circle/>').parent, isNull) | 59 expect(new svg.SvgElement.svg('<circle/>').parent, isNull) |
62 ); | 60 ); |
63 | 61 |
64 test('empty', () { | 62 test('empty', () { |
65 expect(() => new svg.SvgElement.svg(""), throwsStateError); | 63 expect(() => new svg.SvgElement.svg(""), throwsStateError); |
66 }); | 64 }); |
67 | 65 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 group('PathElement', () { | 473 group('PathElement', () { |
476 test('pathSegList', () { | 474 test('pathSegList', () { |
477 svg.PathElement path = | 475 svg.PathElement path = |
478 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); | 476 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); |
479 for (var seg in path.pathSegList) { | 477 for (var seg in path.pathSegList) { |
480 expect(seg is svg.PathSeg, isTrue); | 478 expect(seg is svg.PathSeg, isTrue); |
481 } | 479 } |
482 }); | 480 }); |
483 }); | 481 }); |
484 } | 482 } |
OLD | NEW |