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/unittest.dart'); | 6 #import('../../pkg/unittest/unittest.dart'); |
7 #import('../../pkg/unittest/html_config.dart'); | 7 #import('../../pkg/unittest/html_config.dart'); |
8 #import('dart:html'); | 8 #import('dart:html'); |
9 | 9 |
10 expectLargeRect(ClientRect rect) { | 10 expectLargeRect(ClientRect rect) { |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 </p> | 624 </p> |
625 <hr class='q'/> | 625 <hr class='q'/> |
626 </div> | 626 </div> |
627 """).queryAll('.q'); | 627 """).queryAll('.q'); |
628 } | 628 } |
629 | 629 |
630 List<Element> getEmptyQueryAll() => new Element.tag('div').queryAll('img'); | 630 List<Element> getEmptyQueryAll() => new Element.tag('div').queryAll('img'); |
631 | 631 |
632 void testUnsupported(String name, void f()) { | 632 void testUnsupported(String name, void f()) { |
633 test(name, () { | 633 test(name, () { |
634 Expect.throws(f, (e) => e is UnsupportedOperationException); | 634 Expect.throws(f, (e) => e is StateError); |
635 }); | 635 }); |
636 } | 636 } |
637 | 637 |
638 test('last', () { | 638 test('last', () { |
639 Expect.isTrue(getQueryAll().last() is HRElement); | 639 Expect.isTrue(getQueryAll().last() is HRElement); |
640 }); | 640 }); |
641 | 641 |
642 test('forEach', () { | 642 test('forEach', () { |
643 var els = []; | 643 var els = []; |
644 getQueryAll().forEach((el) => els.add(el)); | 644 getQueryAll().forEach((el) => els.add(el)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 }); | 739 }); |
740 | 740 |
741 test('getRange', () { | 741 test('getRange', () { |
742 var range = makeElList().getRange(1, 2); | 742 var range = makeElList().getRange(1, 2); |
743 Expect.isTrue(range is List<Element>); | 743 Expect.isTrue(range is List<Element>); |
744 Expect.isTrue(range[0] is ImageElement); | 744 Expect.isTrue(range[0] is ImageElement); |
745 Expect.isTrue(range[1] is InputElement); | 745 Expect.isTrue(range[1] is InputElement); |
746 }); | 746 }); |
747 }); | 747 }); |
748 } | 748 } |
OLD | NEW |