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 ElementTest; | 5 library ElementTest; |
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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 expect(el.children.removeLast(), isImageElement); | 639 expect(el.children.removeLast(), isImageElement); |
640 expect(el.children.length, 1); | 640 expect(el.children.length, 1); |
641 }); | 641 }); |
642 | 642 |
643 test('getRange', () { | 643 test('getRange', () { |
644 var el = makeElementWithChildren(); | 644 var el = makeElementWithChildren(); |
645 expect(el.children.getRange(1, 1), isElementList); | 645 expect(el.children.getRange(1, 1), isElementList); |
646 }); | 646 }); |
647 }); | 647 }); |
648 | 648 |
| 649 group('matches', () { |
| 650 test('matches', () { |
| 651 var element = new DivElement(); |
| 652 element.classes.add('test'); |
| 653 |
| 654 expect(element.matches('div'), true); |
| 655 expect(element.matches('span'), false); |
| 656 expect(element.matches('.test'), true); |
| 657 }); |
| 658 }); |
| 659 |
649 group('queryAll', () { | 660 group('queryAll', () { |
650 List<Element> getQueryAll() { | 661 List<Element> getQueryAll() { |
651 return new Element.html(""" | 662 return new Element.html(""" |
652 <div> | 663 <div> |
653 <hr/> | 664 <hr/> |
654 <a class='q' href='http://dartlang.org'>Dart!</a> | 665 <a class='q' href='http://dartlang.org'>Dart!</a> |
655 <p> | 666 <p> |
656 <span class='q'>Hello</span>, | 667 <span class='q'>Hello</span>, |
657 <em>world</em>! | 668 <em>world</em>! |
658 </p> | 669 </p> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 }); | 784 }); |
774 | 785 |
775 test('getRange', () { | 786 test('getRange', () { |
776 var range = makeElList().getRange(1, 2); | 787 var range = makeElList().getRange(1, 2); |
777 expect(range, isElementList); | 788 expect(range, isElementList); |
778 expect(range[0], isImageElement); | 789 expect(range[0], isImageElement); |
779 expect(range[1], isInputElement); | 790 expect(range[1], isInputElement); |
780 }); | 791 }); |
781 }); | 792 }); |
782 } | 793 } |
OLD | NEW |