Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: tests/html/svg_2_test.dart

Issue 11275054: Modified unittest to use new argument syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #library('SVG2Test'); 1 #library('SVG2Test');
2 #import('../../pkg/unittest/unittest.dart'); 2 #import('../../pkg/unittest/unittest.dart');
3 #import('../../pkg/unittest/html_config.dart'); 3 #import('../../pkg/unittest/html_config.dart');
4 #import('dart:html'); 4 #import('dart:html');
5 5
6 // Test that SVG elements explicitly implement the IDL interfaces (is-checks 6 // Test that SVG elements explicitly implement the IDL interfaces (is-checks
7 // only, see SVGTest3 for behavioural tests). 7 // only, see SVGTest3 for behavioural tests).
8 8
9 main() { 9 main() {
10 10
11 insertTestDiv() { 11 insertTestDiv() {
12 var element = new Element.tag('div'); 12 var element = new Element.tag('div');
13 element.innerHTML = r''' 13 element.innerHTML = r'''
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 document.body.nodes.add(element); 18 document.body.nodes.add(element);
19 return element; 19 return element;
20 } 20 }
21 21
22 useHtmlConfiguration(); 22 useHtmlConfiguration();
23 23
24 test('rect_isChecks', () { 24 test('rect_isChecks', () {
25 var div = insertTestDiv(); 25 var div = insertTestDiv();
26 var r = document.query('#rect1'); 26 var r = document.query('#rect1');
27 27
28 // Direct inheritance chain 28 // Direct inheritance chain
29 Expect.isTrue(r is SVGElement); 29 expect(r, new isInstanceOf<SVGElement>('SVGElement'));
30 Expect.isTrue(r is Element); 30 expect(r, new isInstanceOf<Element>('Element'));
31 Expect.isTrue(r is Node); 31 expect(r, new isInstanceOf<Node>('Node'));
32 32
33 // Other implemented interfaces. 33 // Other implemented interfaces.
34 Expect.isTrue(r is SVGTests); 34 expect(r, new isInstanceOf<SVGTests>('SVGTests'));
35 Expect.isTrue(r is SVGLangSpace); 35 expect(r, new isInstanceOf<SVGLangSpace>('SVGLangSpace'));
36 Expect.isTrue(r is SVGExternalResourcesRequired); 36 expect(r, new isInstanceOf<SVGExternalResourcesRequired>(
37 Expect.isTrue(r is SVGStylable); 37 'SVGExternalResourcesRequired'));
38 Expect.isTrue(r is SVGTransformable); 38 expect(r, new isInstanceOf<SVGStylable>('SVGStylable'));
39 Expect.isTrue(r is SVGLocatable); 39 expect(r, new isInstanceOf<SVGTransformable>('SVGTransformable'));
40 expect(r, new isInstanceOf<SVGLocatable>('SVGLocatable'));
40 41
41 // Interfaces not implemented. 42 // Interfaces not implemented.
42 Expect.isFalse(r is SVGNumber); 43 // TODO(gram): use this version when dart2js handles 'is' properly.
43 Expect.isFalse(r is SVGRect); 44 // expect(r, isNot(new isInstanceOf<SVGNumber>('SVGNumber')));
44 Expect.isFalse(r is SVGSVGElement); 45 expect(r is! SVGNumber, isTrue);
46 // TODO(gram): use this version when dart2js handles 'is' properly.
47 // expect(r, isNot(new isInstanceOf<SVGRect>('SVGRect')));
48 expect(r is! SVGRect, isTrue);
49 expect(r,
50 isNot(new isInstanceOf<SVGSVGElement>('SVGSVGElement')));
45 51
46 div.remove(); 52 div.remove();
47 }); 53 });
48 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698