| OLD | NEW |
| 1 #library('SVG3Test'); | 1 #library('SVG3Test'); |
| 2 #import('../../lib/unittest/unittest.dart'); | 2 #import('../../lib/unittest/unittest.dart'); |
| 3 #import('../../lib/unittest/dom_config.dart'); | 3 #import('../../lib/unittest/html_config.dart'); |
| 4 #import('dart:dom'); | 4 #import('dart:html'); |
| 5 | 5 |
| 6 // Test that SVG elements have the operations advertised through all the IDL | 6 // Test that SVG elements have the operations advertised through all the IDL |
| 7 // interfaces. This is a 'duck typing' test, and does not explicitly use 'is' | 7 // interfaces. This is a 'duck typing' test, and does not explicitly use 'is' |
| 8 // checks on the expected interfaces (that is in SVGTest2). | 8 // checks on the expected interfaces (that is in SVGTest2). |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 | 11 |
| 12 insertTestDiv() { | 12 insertTestDiv() { |
| 13 var element = document.createElement('div'); | 13 var element = new Element.tag('div'); |
| 14 element.innerHTML = @''' | 14 element.innerHTML = @''' |
| 15 <svg id='svg1' width='200' height='100'> | 15 <svg id='svg1' width='200' height='100'> |
| 16 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 16 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 17 </svg> | 17 </svg> |
| 18 '''; | 18 '''; |
| 19 document.body.appendChild(element); | 19 document.body.nodes.add(element); |
| 20 return element; | 20 return element; |
| 21 } | 21 } |
| 22 | 22 |
| 23 useDomConfiguration(); | 23 useHtmlConfiguration(); |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Verifies that [e] supports the operations on the SVGTests interface. | 26 * Verifies that [e] supports the operations on the SVGTests interface. |
| 27 */ | 27 */ |
| 28 checkSVGTests(e) { | 28 checkSVGTests(e) { |
| 29 // Just check that the operations seem to exist. | 29 // Just check that the operations seem to exist. |
| 30 var rx = e.requiredExtensions; | 30 var rx = e.requiredExtensions; |
| 31 Expect.isTrue(rx is SVGStringList); | 31 Expect.isTrue(rx is SVGStringList); |
| 32 var rf = e.requiredFeatures; | 32 var rf = e.requiredFeatures; |
| 33 Expect.isTrue(rf is SVGStringList); | 33 Expect.isTrue(rf is SVGStringList); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 61 var b = e.externalResourcesRequired; | 61 var b = e.externalResourcesRequired; |
| 62 Expect.isTrue(b is SVGAnimatedBoolean); | 62 Expect.isTrue(b is SVGAnimatedBoolean); |
| 63 Expect.isFalse(b.baseVal); | 63 Expect.isFalse(b.baseVal); |
| 64 Expect.isFalse(b.animVal); | 64 Expect.isFalse(b.animVal); |
| 65 } | 65 } |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * Verifies that [e] supports the operations on the SVGStylable interface. | 68 * Verifies that [e] supports the operations on the SVGStylable interface. |
| 69 */ | 69 */ |
| 70 checkSVGStylable(e) { | 70 checkSVGStylable(e) { |
| 71 var className = e.className; | 71 var className = e.$dom_$dom_svgClassName; |
| 72 Expect.isTrue(className is SVGAnimatedString); | 72 Expect.isTrue(className is SVGAnimatedString); |
| 73 | 73 |
| 74 var s = e.style; | 74 var s = e.style; |
| 75 Expect.isTrue(s is CSSStyleDeclaration); | 75 Expect.isTrue(s is CSSStyleDeclaration); |
| 76 | 76 |
| 77 var attributeA = e.getPresentationAttribute('A'); | 77 var attributeA = e.getPresentationAttribute('A'); |
| 78 Expect.isTrue(attributeA === null || attributeA is CSSValue); | 78 Expect.isTrue(attributeA === null || attributeA is CSSValue); |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** | 81 /** |
| (...skipping 22 matching lines...) Expand all Loading... |
| 104 * interface. | 104 * interface. |
| 105 */ | 105 */ |
| 106 checkSVGTransformable(e) { | 106 checkSVGTransformable(e) { |
| 107 var trans = e.transform; | 107 var trans = e.transform; |
| 108 Expect.isTrue(trans is SVGAnimatedTransformList); | 108 Expect.isTrue(trans is SVGAnimatedTransformList); |
| 109 } | 109 } |
| 110 | 110 |
| 111 testRect(name, checker) { | 111 testRect(name, checker) { |
| 112 test(name, () { | 112 test(name, () { |
| 113 var div = insertTestDiv(); | 113 var div = insertTestDiv(); |
| 114 var r = document.getElementById('rect1'); | 114 var r = document.query('#rect1'); |
| 115 checker(r); | 115 checker(r); |
| 116 document.body.removeChild(div); | 116 div.remove(); |
| 117 }); | 117 }); |
| 118 } | 118 } |
| 119 | 119 |
| 120 testRect('rect_SVGTests', checkSVGTests); | 120 testRect('rect_SVGTests', checkSVGTests); |
| 121 testRect('rect_SVGLangSpace', checkSVGLangSpace); | 121 testRect('rect_SVGLangSpace', checkSVGLangSpace); |
| 122 testRect('rect_SVGExternalResourcesRequired', | 122 testRect('rect_SVGExternalResourcesRequired', |
| 123 checkSVGExternalResourcesRequired); | 123 checkSVGExternalResourcesRequired); |
| 124 testRect('rect_SVGStylable', checkSVGStylable); | 124 testRect('rect_SVGStylable', checkSVGStylable); |
| 125 testRect('rect_SVGLocatable', checkSVGLocatable); | 125 testRect('rect_SVGLocatable', checkSVGLocatable); |
| 126 testRect('rect_SVGTransformable', checkSVGTransformable); | 126 testRect('rect_SVGTransformable', checkSVGTransformable); |
| 127 | 127 |
| 128 } | 128 } |
| OLD | NEW |