| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 validator_test; | 5 library validator_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:svg' as svg; | 9 import 'dart:svg' as svg; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 testHtml('blocks namespaced common elements', | 105 testHtml('blocks namespaced common elements', |
| 106 validator, | 106 validator, |
| 107 '<ns:div></ns:div>', | 107 '<ns:div></ns:div>', |
| 108 ''); | 108 ''); |
| 109 | 109 |
| 110 testHtml('allows CDATA sections', | 110 testHtml('allows CDATA sections', |
| 111 validator, | 111 validator, |
| 112 '<span>![CDATA[ some text ]]></span>'); | 112 '<span>![CDATA[ some text ]]></span>'); |
| 113 | 113 |
| 114 test('sanitizes template contents', () { | 114 test('sanitizes template contents', () { |
| 115 if (!TemplateElement.supported) return; |
| 116 |
| 115 var html = '<template>' | 117 var html = '<template>' |
| 116 '<div></div>' | 118 '<div></div>' |
| 117 '<script></script>' | 119 '<script></script>' |
| 118 '<img src="http://example.com/foo"/>' | 120 '<img src="http://example.com/foo"/>' |
| 119 '</template>'; | 121 '</template>'; |
| 120 | 122 |
| 121 var fragment = document.body.createFragment(html, validator: validator); | 123 var fragment = document.body.createFragment(html, validator: validator); |
| 122 var template = fragment.nodes.single; | 124 var template = fragment.nodes.single; |
| 123 | 125 |
| 124 var expectedContent = document.body.createFragment( | 126 var expectedContent = document.body.createFragment( |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 '<image xlink:href="foo" data-foo="bar"/>' | 450 '<image xlink:href="foo" data-foo="bar"/>' |
| 449 '</svg>'; | 451 '</svg>'; |
| 450 | 452 |
| 451 var fragment = new DocumentFragment.svg(svgText); | 453 var fragment = new DocumentFragment.svg(svgText); |
| 452 var element = fragment.nodes.first; | 454 var element = fragment.nodes.first; |
| 453 expect(element is svg.SvgSvgElement, isTrue); | 455 expect(element is svg.SvgSvgElement, isTrue); |
| 454 expect(element.children[0] is svg.ImageElement, isTrue); | 456 expect(element.children[0] is svg.ImageElement, isTrue); |
| 455 }); | 457 }); |
| 456 }); | 458 }); |
| 457 } | 459 } |
| OLD | NEW |