| OLD | NEW |
| 1 library SVG1Test; | 1 library SVG1Test; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:svg' as svg; | 5 import 'dart:svg' as svg; |
| 6 | 6 |
| 7 // Test that SVG is present in dart:html API | 7 // Test that SVG is present in dart:html API |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 useHtmlConfiguration(); | 10 useHtmlConfiguration(); |
| 11 | 11 |
| 12 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); | 12 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); |
| 13 | 13 |
| 14 test('simpleRect', () { | 14 test('simpleRect', () { |
| 15 var div = new Element.tag('div'); | 15 var div = new Element.tag('div'); |
| 16 document.body.nodes.add(div); | 16 document.body.nodes.add(div); |
| 17 div.innerHTML = r''' | 17 div.innerHtml = r''' |
| 18 <svg id='svg1' width='200' height='100'> | 18 <svg id='svg1' width='200' height='100'> |
| 19 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 19 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
| 20 </svg> | 20 </svg> |
| 21 | 21 |
| 22 '''; | 22 '''; |
| 23 | 23 |
| 24 var e = document.query('#svg1'); | 24 var e = document.query('#svg1'); |
| 25 expect(e, isNotNull); | 25 expect(e, isNotNull); |
| 26 | 26 |
| 27 svg.RectElement r = document.query('#rect1'); | 27 svg.RectElement r = document.query('#rect1'); |
| 28 expect(r.x.baseVal.value, 10); | 28 expect(r.x.baseVal.value, 10); |
| 29 expect(r.y.baseVal.value, 20); | 29 expect(r.y.baseVal.value, 20); |
| 30 expect(r.height.baseVal.value, 40); | 30 expect(r.height.baseVal.value, 40); |
| 31 expect(r.width.baseVal.value, 130); | 31 expect(r.width.baseVal.value, 130); |
| 32 expect(r.rx.baseVal.value, 5); | 32 expect(r.rx.baseVal.value, 5); |
| 33 }); | 33 }); |
| 34 | 34 |
| 35 test('trailing newline', () { | 35 test('trailing newline', () { |
| 36 // Ensures that we handle SVG with trailing newlines. | 36 // Ensures that we handle SVG with trailing newlines. |
| 37 var logo = new svg.SvgElement.svg(""" | 37 var logo = new svg.SvgElement.svg(""" |
| 38 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> | 38 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> |
| 39 <path/> | 39 <path/> |
| 40 </svg> | 40 </svg> |
| 41 """); | 41 """); |
| 42 | 42 |
| 43 expect(logo, isSvgElement); | 43 expect(logo, isSvgElement); |
| 44 | 44 |
| 45 }); | 45 }); |
| 46 } | 46 } |
| OLD | NEW |