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

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

Issue 23523002: Revert "First rev of Safe DOM" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months 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
« no previous file with comments | « tests/html/safe_dom_test.dart ('k') | tests/html/svgelement_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SVGTest; 5 library SVGTest;
6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart';
6 import 'dart:html'; 8 import 'dart:html';
7 import 'dart:svg' as svg; 9 import 'dart:svg' as svg;
8 import 'package:unittest/html_individual_config.dart';
9 import 'package:unittest/unittest.dart';
10 10
11 main() { 11 main() {
12 useHtmlIndividualConfiguration(); 12 useHtmlIndividualConfiguration();
13 13
14 group('svgPresence', () { 14 group('svgPresence', () {
15 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); 15 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement');
16 16
17 test('simpleRect', () { 17 test('simpleRect', () {
18 var div = new Element.tag('div'); 18 var div = new Element.tag('div');
19 document.body.append(div); 19 document.body.append(div);
20 div.setInnerHtml(r''' 20 div.innerHtml = r'''
21 <svg id='svg1' width='200' height='100'> 21 <svg id='svg1' width='200' height='100'>
22 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> 22 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect>
23 </svg> 23 </svg>
24 ''', validator: new NodeValidatorBuilder()..allowSvg()); 24
25 ''';
25 26
26 var e = document.query('#svg1'); 27 var e = document.query('#svg1');
27 expect(e, isNotNull); 28 expect(e, isNotNull);
28 29
29 svg.RectElement r = document.query('#rect1'); 30 svg.RectElement r = document.query('#rect1');
30 expect(r.x.baseVal.value, 10); 31 expect(r.x.baseVal.value, 10);
31 expect(r.y.baseVal.value, 20); 32 expect(r.y.baseVal.value, 20);
32 expect(r.height.baseVal.value, 40); 33 expect(r.height.baseVal.value, 40);
33 expect(r.width.baseVal.value, 130); 34 expect(r.width.baseVal.value, 130);
34 expect(r.rx.baseVal.value, 5); 35 expect(r.rx.baseVal.value, 5);
(...skipping 10 matching lines...) Expand all
45 expect(logo, isSvgElement); 46 expect(logo, isSvgElement);
46 47
47 }); 48 });
48 }); 49 });
49 50
50 group('svgInterfaceMatch', () { 51 group('svgInterfaceMatch', () {
51 // Test that SVG elements explicitly implement the IDL interfaces (is-checks 52 // Test that SVG elements explicitly implement the IDL interfaces (is-checks
52 // only, see SVGTest3 for behavioural tests). 53 // only, see SVGTest3 for behavioural tests).
53 insertTestDiv() { 54 insertTestDiv() {
54 var element = new Element.tag('div'); 55 var element = new Element.tag('div');
55 element.setInnerHtml(r''' 56 element.innerHtml = r'''
56 <svg id='svg1' width='200' height='100'> 57 <svg id='svg1' width='200' height='100'>
57 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect> 58 <rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect>
58 </svg> 59 </svg>
59 ''', validator: new NodeValidatorBuilder()..allowSvg()); 60 ''';
60 document.body.append(element); 61 document.body.append(element);
61 return element; 62 return element;
62 } 63 }
63 64
64 65
65 var isElement = predicate((x) => x is Element, 'is an Element'); 66 var isElement = predicate((x) => x is Element, 'is an Element');
66 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); 67 var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement');
67 var isSvgSvgElement = 68 var isSvgSvgElement =
68 predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement'); 69 predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement');
69 var isNode = predicate((x) => x is Node, 'is a Node'); 70 var isNode = predicate((x) => x is Node, 'is a Node');
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 test(name, () { 125 test(name, () {
125 var div = insertTestDiv(); 126 var div = insertTestDiv();
126 var r = document.query('#rect1'); 127 var r = document.query('#rect1');
127 checker(r); 128 checker(r);
128 div.remove(); 129 div.remove();
129 }); 130 });
130 } 131 }
131 }); 132 });
132 133
133 } 134 }
OLDNEW
« no previous file with comments | « tests/html/safe_dom_test.dart ('k') | tests/html/svgelement_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698