OLD | NEW |
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 var classes = el.classes; | 419 var classes = el.classes; |
420 expect(el.classes.length, 0); | 420 expect(el.classes.length, 0); |
421 classes.toggle('foo'); | 421 classes.toggle('foo'); |
422 expect(el.classes.length, 1); | 422 expect(el.classes.length, 1); |
423 classes.toggle('foo'); | 423 classes.toggle('foo'); |
424 expect(el.classes.length, 0); | 424 expect(el.classes.length, 0); |
425 }); | 425 }); |
426 }); | 426 }); |
427 | 427 |
428 group('getBoundingClientRect', () { | 428 group('getBoundingClientRect', () { |
429 test('is a Rect', () { | 429 test('is a Rectangle', () { |
430 var element = new svg.RectElement(); | 430 var element = new svg.RectElement(); |
431 element.attributes['width'] = '100'; | 431 element.attributes['width'] = '100'; |
432 element.attributes['height'] = '100'; | 432 element.attributes['height'] = '100'; |
433 var root = new svg.SvgSvgElement(); | 433 var root = new svg.SvgSvgElement(); |
434 root.append(element); | 434 root.append(element); |
435 | 435 |
436 document.body.append(root); | 436 document.body.append(root); |
437 | 437 |
438 var rect = element.getBoundingClientRect(); | 438 var rect = element.getBoundingClientRect(); |
439 expect(rect is Rect, isTrue); | 439 expect(rect is Rectangle, isTrue); |
440 expect(rect.width, closeTo(100, 1)); | 440 expect(rect.width, closeTo(100, 1)); |
441 expect(rect.height, closeTo(100, 1)); | 441 expect(rect.height, closeTo(100, 1)); |
442 }); | 442 }); |
443 }); | 443 }); |
444 | 444 |
445 group('PathElement', () { | 445 group('PathElement', () { |
446 test('pathSegList', () { | 446 test('pathSegList', () { |
447 svg.PathElement path = | 447 svg.PathElement path = |
448 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); | 448 new svg.SvgElement.svg('<path d="M 100 100 L 300 100 L 200 300 z"/>'); |
449 for (var seg in path.pathSegList) { | 449 for (var seg in path.pathSegList) { |
450 expect(seg is svg.PathSeg, isTrue); | 450 expect(seg is svg.PathSeg, isTrue); |
451 } | 451 } |
452 }); | 452 }); |
453 }); | 453 }); |
454 } | 454 } |
OLD | NEW |