OLD | NEW |
1 #library('SVG1Test'); | 1 #library('SVG1Test'); |
2 #import('../../../testing/unittest/unittest.dart'); | 2 #import('../../../testing/unittest/unittest_dom.dart'); |
3 #import('dart:dom'); | 3 #import('dart:dom'); |
4 | 4 |
5 // Test that SVG is present in dart:dom API | 5 // Test that SVG is present in dart:dom API |
6 | 6 |
7 main() { | 7 main() { |
8 forLayoutTests(); | 8 forLayoutTests(); |
9 | 9 |
10 test('simpleRect', () { | 10 test('simpleRect', () { |
11 var div = document.createElement('div'); | 11 var div = document.createElement('div'); |
12 document.body.appendChild(div); | 12 document.body.appendChild(div); |
13 div.innerHTML = @''' | 13 div.innerHTML = @''' |
14 <svg id='svg1' width='200' height='100'> | 14 <svg id='svg1' width='200' height='100'> |
15 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> | 15 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> |
16 </svg> | 16 </svg> |
17 '''; | 17 '''; |
18 | 18 |
19 var e = document.getElementById('svg1'); | 19 var e = document.getElementById('svg1'); |
20 Expect.isTrue(e != null); | 20 Expect.isTrue(e != null); |
21 | 21 |
22 SVGRectElement r = document.getElementById('rect1'); | 22 SVGRectElement r = document.getElementById('rect1'); |
23 Expect.equals(10, r.x.baseVal.value); | 23 Expect.equals(10, r.x.baseVal.value); |
24 Expect.equals(20, r.y.baseVal.value); | 24 Expect.equals(20, r.y.baseVal.value); |
25 Expect.equals(40, r.height.baseVal.value); | 25 Expect.equals(40, r.height.baseVal.value); |
26 Expect.equals(130, r.width.baseVal.value); | 26 Expect.equals(130, r.width.baseVal.value); |
27 Expect.equals(5, r.rx.baseVal.value); | 27 Expect.equals(5, r.rx.baseVal.value); |
28 }); | 28 }); |
29 } | 29 } |
OLD | NEW |