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 ' | 56 '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">\r\n ' |
Bill Hesse
2015/06/29 10:32:41
Can you get rid of this one with the \r\n that you
herhut
2015/06/29 10:39:00
Acknowledged.
| |
57 '<circle />\r\n <path />\r\n</svg>')); | 57 '<circle />\r\n <path />\r\n</svg>')); |
58 }); | 58 }); |
59 | 59 |
60 test('has no parent', () => | 60 test('has no parent', () => |
61 expect(new svg.SvgElement.svg('<circle/>').parent, isNull) | 61 expect(new svg.SvgElement.svg('<circle/>').parent, isNull) |
62 ); | 62 ); |
63 | 63 |
64 test('empty', () { | 64 test('empty', () { |
65 expect(() => new svg.SvgElement.svg(""), throwsStateError); | 65 expect(() => new svg.SvgElement.svg(""), throwsStateError); |
66 }); | 66 }); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 group('PathElement', () { | 475 group('PathElement', () { |
476 test('pathSegList', () { | 476 test('pathSegList', () { |
477 svg.PathElement path = | 477 svg.PathElement path = |
478 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); | 478 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); |
479 for (var seg in path.pathSegList) { | 479 for (var seg in path.pathSegList) { |
480 expect(seg is svg.PathSeg, isTrue); | 480 expect(seg is svg.PathSeg, isTrue); |
481 } | 481 } |
482 }); | 482 }); |
483 }); | 483 }); |
484 } | 484 } |
OLD | NEW |