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

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

Issue 11576060: Fixing up some Element and SvgElement tests to make them more platform-independent (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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/html.status ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 SvgElementTest; 5 library SvgElementTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart'; 7 import '../../pkg/unittest/lib/html_individual_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:svg' as svg; 9 import 'dart:svg' as svg;
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 testConstructor('title', (e) => e is svg.TitleElement); 147 testConstructor('title', (e) => e is svg.TitleElement);
148 testConstructor('use', (e) => e is svg.UseElement); 148 testConstructor('use', (e) => e is svg.UseElement);
149 testConstructor('view', (e) => e is svg.ViewElement); 149 testConstructor('view', (e) => e is svg.ViewElement);
150 }); 150 });
151 151
152 group('outerHtml', () { 152 group('outerHtml', () {
153 test('outerHtml', () { 153 test('outerHtml', () {
154 final el = new svg.SvgSvgElement(); 154 final el = new svg.SvgSvgElement();
155 el.children.add(new svg.CircleElement()); 155 el.children.add(new svg.CircleElement());
156 el.children.add(new svg.PathElement()); 156 el.children.add(new svg.PathElement());
157 expect(el.outerHtml, 157 expect([
158 '<svg version="1.1"><circle></circle><path></path></svg>'); 158 '<svg version="1.1"><circle></circle><path></path></svg>',
159 '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">'
160 '<circle /><path /></svg>',
161 ].contains(el.outerHtml), true);
159 }); 162 });
160 }); 163 });
161 164
162 group('innerHtml', () { 165 group('innerHtml', () {
163 test('get', () { 166 test('get', () {
164 final el = new svg.SvgSvgElement(); 167 final el = new svg.SvgSvgElement();
165 el.children.add(new svg.CircleElement()); 168 el.children.add(new svg.CircleElement());
166 el.children.add(new svg.PathElement()); 169 el.children.add(new svg.PathElement());
167 expect(el.innerHtml, '<circle></circle><path></path>'); 170 // Allow for odd IE serialization.
171 expect([
172 '<circle></circle><path></path>',
173 '<circle xmlns="http://www.w3.org/2000/svg" />'
Emily Fortuna 2012/12/18 18:47:15 Is this something we could add automatically in ou
blois 2012/12/18 20:50:04 It's optional- IE includes the xmlns while Chrome
174 '<path xmlns="http://www.w3.org/2000/svg" />'
175 ].contains(el.innerHtml), true);
168 }); 176 });
169 177
170 test('set', () { 178 test('set', () {
171 final el = new svg.SvgSvgElement(); 179 final el = new svg.SvgSvgElement();
172 el.children.add(new svg.CircleElement()); 180 el.children.add(new svg.CircleElement());
173 el.children.add(new svg.PathElement()); 181 el.children.add(new svg.PathElement());
174 el.innerHtml = '<rect></rect><a></a>'; 182 el.innerHtml = '<rect></rect><a></a>';
175 expect(_nodeStrings(el.children), ["rect", "a"]); 183 expect(_nodeStrings(el.children), ["rect", "a"]);
176 }); 184 });
177 }); 185 });
(...skipping 21 matching lines...) Expand all
199 207
200 el.children.length = 0; 208 el.children.length = 0;
201 expect(el.children.contains(items[0]), false); 209 expect(el.children.contains(items[0]), false);
202 }); 210 });
203 }); 211 });
204 212
205 group('elementset', () { 213 group('elementset', () {
206 test('set', () { 214 test('set', () {
207 final el = new svg.SvgSvgElement(); 215 final el = new svg.SvgSvgElement();
208 el.children = [new svg.SvgElement.tag("circle"), new svg.SvgElement.tag("p ath")]; 216 el.children = [new svg.SvgElement.tag("circle"), new svg.SvgElement.tag("p ath")];
209 expect(el.innerHtml, '<circle></circle><path></path>'); 217 expect(el.nodes.length, 2);
218 expect(el.nodes[0] is svg.CircleElement, true);
219 expect(el.nodes[1] is svg.PathElement, true);
210 }); 220 });
211 }); 221 });
212 222
213 group('css', () { 223 group('css', () {
214 test('classes', () { 224 test('classes', () {
215 var el = new svg.CircleElement(); 225 var el = new svg.CircleElement();
216 var classes = el.classes; 226 var classes = el.classes;
217 expect(el.classes.length, 0); 227 expect(el.classes.length, 0);
218 classes.toggle('foo'); 228 classes.toggle('foo');
219 expect(el.classes.length, 1); 229 expect(el.classes.length, 1);
220 classes.toggle('foo'); 230 classes.toggle('foo');
221 expect(el.classes.length, 0); 231 expect(el.classes.length, 0);
222 }); 232 });
223 }); 233 });
224 } 234 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698