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

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

Issue 11418075: Dartifying members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixing menuelement.compact exclusion. 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/svg_3_test.dart ('k') | tests/html/url_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) 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 26 matching lines...) Expand all
37 group('additionalConstructors', () { 37 group('additionalConstructors', () {
38 group('svg', () { 38 group('svg', () {
39 test('valid', () { 39 test('valid', () {
40 final svgContent = """ 40 final svgContent = """
41 <svg version="1.1"> 41 <svg version="1.1">
42 <circle></circle> 42 <circle></circle>
43 <path></path> 43 <path></path>
44 </svg>"""; 44 </svg>""";
45 final el = new svg.SvgElement.svg(svgContent); 45 final el = new svg.SvgElement.svg(svgContent);
46 expect(el, isSvgSvgElement); 46 expect(el, isSvgSvgElement);
47 expect(el.innerHTML, "<circle></circle><path></path>"); 47 expect(el.innerHtml, "<circle></circle><path></path>");
48 expect(el.outerHTML, svgContent); 48 expect(el.outerHtml, svgContent);
49 }); 49 });
50 50
51 test('has no parent', () => 51 test('has no parent', () =>
52 expect(new svg.SvgElement.svg('<circle/>').parent, isNull) 52 expect(new svg.SvgElement.svg('<circle/>').parent, isNull)
53 ); 53 );
54 54
55 test('empty', () { 55 test('empty', () {
56 expect(() => new svg.SvgElement.svg(""), throwsArgumentError); 56 expect(() => new svg.SvgElement.svg(""), throwsArgumentError);
57 }); 57 });
58 58
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 testConstructor('switch', (e) => e is svg.SwitchElement); 142 testConstructor('switch', (e) => e is svg.SwitchElement);
143 testConstructor('symbol', (e) => e is svg.SymbolElement); 143 testConstructor('symbol', (e) => e is svg.SymbolElement);
144 testConstructor('tspan', (e) => e is svg.TSpanElement); 144 testConstructor('tspan', (e) => e is svg.TSpanElement);
145 testConstructor('text', (e) => e is svg.TextElement); 145 testConstructor('text', (e) => e is svg.TextElement);
146 testConstructor('textPath', (e) => e is svg.TextPathElement); 146 testConstructor('textPath', (e) => e is svg.TextPathElement);
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(el.outerHtml,
158 '<svg version="1.1"><circle></circle><path></path></svg>'); 158 '<svg version="1.1"><circle></circle><path></path></svg>');
159 }); 159 });
160 }); 160 });
161 161
162 group('innerHTML', () { 162 group('innerHtml', () {
163 test('get', () { 163 test('get', () {
164 final el = new svg.SvgSvgElement(); 164 final el = new svg.SvgSvgElement();
165 el.children.add(new svg.CircleElement()); 165 el.children.add(new svg.CircleElement());
166 el.children.add(new svg.PathElement()); 166 el.children.add(new svg.PathElement());
167 expect(el.innerHTML, '<circle></circle><path></path>'); 167 expect(el.innerHtml, '<circle></circle><path></path>');
168 }); 168 });
169 169
170 test('set', () { 170 test('set', () {
171 final el = new svg.SvgSvgElement(); 171 final el = new svg.SvgSvgElement();
172 el.children.add(new svg.CircleElement()); 172 el.children.add(new svg.CircleElement());
173 el.children.add(new svg.PathElement()); 173 el.children.add(new svg.PathElement());
174 el.innerHTML = '<rect></rect><a></a>'; 174 el.innerHtml = '<rect></rect><a></a>';
175 expect(_nodeStrings(el.children), ["rect", "a"]); 175 expect(_nodeStrings(el.children), ["rect", "a"]);
176 }); 176 });
177 }); 177 });
178 178
179 group('elementget', () { 179 group('elementget', () {
180 test('get', () { 180 test('get', () {
181 final el = new svg.SvgElement.svg(""" 181 final el = new svg.SvgElement.svg("""
182 <svg version="1.1"> 182 <svg version="1.1">
183 <circle></circle> 183 <circle></circle>
184 <path></path> 184 <path></path>
185 text 185 text
186 </svg>"""); 186 </svg>""");
187 expect(_nodeStrings(el.children), ["circle", "path"]); 187 expect(_nodeStrings(el.children), ["circle", "path"]);
188 }); 188 });
189 }); 189 });
190 190
191 group('elementset', () { 191 group('elementset', () {
192 test('set', () { 192 test('set', () {
193 final el = new svg.SvgSvgElement(); 193 final el = new svg.SvgSvgElement();
194 el.children = [new svg.SvgElement.tag("circle"), new svg.SvgElement.tag("p ath")]; 194 el.children = [new svg.SvgElement.tag("circle"), new svg.SvgElement.tag("p ath")];
195 expect(el.innerHTML, '<circle></circle><path></path>'); 195 expect(el.innerHtml, '<circle></circle><path></path>');
196 }); 196 });
197 }); 197 });
198 198
199 group('css', () { 199 group('css', () {
200 test('classes', () { 200 test('classes', () {
201 var el = new svg.CircleElement(); 201 var el = new svg.CircleElement();
202 var classes = el.classes; 202 var classes = el.classes;
203 expect(el.classes.length, 0); 203 expect(el.classes.length, 0);
204 classes.toggle('foo'); 204 classes.toggle('foo');
205 expect(el.classes.length, 1); 205 expect(el.classes.length, 1);
206 classes.toggle('foo'); 206 classes.toggle('foo');
207 expect(el.classes.length, 0); 207 expect(el.classes.length, 0);
208 }); 208 });
209 }); 209 });
210 } 210 }
OLDNEW
« no previous file with comments | « tests/html/svg_3_test.dart ('k') | tests/html/url_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698