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

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

Issue 1098073003: Revert "Enforce token syntax for CssClassSet arguments" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/element_classes_test.dart ('k') | tools/dom/src/CssClassSet.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 'dart:html'; 6 import 'dart:html';
7 import 'dart:svg' as svg; 7 import 'dart:svg' as svg;
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import 'package:unittest/html_individual_config.dart'; 9 import 'package:unittest/html_individual_config.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 group('css', () { 417 group('css', () {
418 test('classes', () { 418 test('classes', () {
419 var el = new svg.CircleElement(); 419 var el = new svg.CircleElement();
420 var classes = el.classes; 420 var classes = el.classes;
421 expect(el.classes.length, 0); 421 expect(el.classes.length, 0);
422 classes.toggle('foo'); 422 classes.toggle('foo');
423 expect(el.classes.length, 1); 423 expect(el.classes.length, 1);
424 classes.toggle('foo'); 424 classes.toggle('foo');
425 expect(el.classes.length, 0); 425 expect(el.classes.length, 0);
426 }); 426 });
427
428 test('classes-add-bad', () {
429 var el = new svg.CircleElement();
430 expect(() => el.classes.add(''), throws);
431 expect(() => el.classes.add('foo bar'), throws);
432 });
433 test('classes-remove-bad', () {
434 expect(() => el.classes.remove(''), throws);
435 expect(() => el.classes.remove('foo bar'), throws);
436 });
437 test('classes-toggle-token', () {
438 var el = new svg.CircleElement();
439 expect(() => el.classes.toggle(''), throws);
440 expect(() => el.classes.toggle('', true), throws);
441 expect(() => el.classes.toggle('', false), throws);
442 expect(() => el.classes.toggle('foo bar'), throws);
443 expect(() => el.classes.toggle('foo bar', true), throws);
444 expect(() => el.classes.toggle('foo bar', false), throws);
445 });
446 test('classes-contains-bad', () {
447 var el = new svg.CircleElement();
448 // Non-strings => false, strings must be valid tokens.
449 expect(el.classes.contains(1), isFalse);
450 expect(() => el.classes.contains(''), throws);
451 expect(() => el.classes.contains('foo bar'), throws);
452 });
453 }); 427 });
454 428
455 group('getBoundingClientRect', () { 429 group('getBoundingClientRect', () {
456 test('is a Rectangle', () { 430 test('is a Rectangle', () {
457 var element = new svg.RectElement(); 431 var element = new svg.RectElement();
458 element.attributes['width'] = '100'; 432 element.attributes['width'] = '100';
459 element.attributes['height'] = '100'; 433 element.attributes['height'] = '100';
460 var root = new svg.SvgSvgElement(); 434 var root = new svg.SvgSvgElement();
461 root.append(element); 435 root.append(element);
462 436
463 document.body.append(root); 437 document.body.append(root);
464 438
465 var rect = element.getBoundingClientRect(); 439 var rect = element.getBoundingClientRect();
466 expect(rect is Rectangle, isTrue); 440 expect(rect is Rectangle, isTrue);
467 expect(rect.width, closeTo(100, 1)); 441 expect(rect.width, closeTo(100, 1));
468 expect(rect.height, closeTo(100, 1)); 442 expect(rect.height, closeTo(100, 1));
469 }); 443 });
470 }); 444 });
471 445
472 group('PathElement', () { 446 group('PathElement', () {
473 test('pathSegList', () { 447 test('pathSegList', () {
474 svg.PathElement path = 448 svg.PathElement path =
475 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); 449 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>');
476 for (var seg in path.pathSegList) { 450 for (var seg in path.pathSegList) {
477 expect(seg is svg.PathSeg, isTrue); 451 expect(seg is svg.PathSeg, isTrue);
478 } 452 }
479 }); 453 });
480 }); 454 });
481 } 455 }
OLDNEW
« no previous file with comments | « tests/html/element_classes_test.dart ('k') | tools/dom/src/CssClassSet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698