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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 'xmlns:xlink="http://www.w3.org/1999/xlink">' | 362 'xmlns:xlink="http://www.w3.org/1999/xlink">' |
363 '<image xlink:href="foo" onerror="something"/>' | 363 '<image xlink:href="foo" onerror="something"/>' |
364 '</svg>', | 364 '</svg>', |
365 '<svg xmlns="http://www.w3.org/2000/svg' | 365 '<svg xmlns="http://www.w3.org/2000/svg' |
366 'xmlns:xlink="http://www.w3.org/1999/xlink">' | 366 'xmlns:xlink="http://www.w3.org/1999/xlink">' |
367 '<image xlink:href="foo"/>' | 367 '<image xlink:href="foo"/>' |
368 '</svg>'); | 368 '</svg>'); |
369 | 369 |
370 testHtml('blocks foreignObject content', | 370 testHtml('blocks foreignObject content', |
371 validator, | 371 validator, |
372 '<svg xmlns="http://www.w3.org/2000/svg>' | 372 '<svg xmlns="http://www.w3.org/2000/svg">' |
373 '<foreignobject width="100" height="150">' | 373 '<foreignobject width="100" height="150">' |
374 '<body xmlns="http://www.w3.org/1999/xhtml">' | 374 '<body xmlns="http://www.w3.org/1999/xhtml">' |
375 '<div>Some content</div>' | 375 '<div>Some content</div>' |
376 '</body>' | 376 '</body>' |
377 '</foreignobject>' | 377 '</foreignobject>' |
| 378 '<number>42</number>' |
378 '</svg>', | 379 '</svg>', |
379 '<svg xmlns="http://www.w3.org/2000/svg>' | 380 '<svg xmlns="http://www.w3.org/2000/svg">' |
380 '<foreignobject width="100" height="150"></foreignobject>' | 381 '<number>42</number>' |
381 '</svg>'); | 382 '</svg>'); |
382 }); | 383 }); |
383 | 384 |
384 group('allowInlineStyles', () { | 385 group('allowInlineStyles', () { |
385 var validator = new NodeValidatorBuilder() | 386 var validator = new NodeValidatorBuilder() |
386 ..allowTextElements() | 387 ..allowTextElements() |
387 ..allowInlineStyles(); | 388 ..allowInlineStyles(); |
388 | 389 |
389 testHtml('allows inline styles', | 390 testHtml('allows inline styles', |
390 validator, | 391 validator, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 '<image xlink:href="foo" data-foo="bar"/>' | 451 '<image xlink:href="foo" data-foo="bar"/>' |
451 '</svg>'; | 452 '</svg>'; |
452 | 453 |
453 var fragment = new DocumentFragment.svg(svgText); | 454 var fragment = new DocumentFragment.svg(svgText); |
454 var element = fragment.nodes.first; | 455 var element = fragment.nodes.first; |
455 expect(element is svg.SvgSvgElement, isTrue); | 456 expect(element is svg.SvgSvgElement, isTrue); |
456 expect(element.children[0] is svg.ImageElement, isTrue); | 457 expect(element.children[0] is svg.ImageElement, isTrue); |
457 }); | 458 }); |
458 }); | 459 }); |
459 } | 460 } |
OLD | NEW |