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:async'; | 8 import 'dart:async'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:svg' as svg; | 10 import 'dart:svg' as svg; |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 ..classes.add('selector') | 767 ..classes.add('selector') |
768 ..children.add(clickOne); | 768 ..children.add(clickOne); |
769 | 769 |
770 Element clickTwo = new Element.a(); | 770 Element clickTwo = new Element.a(); |
771 Element selectorTwo = new Element.div() | 771 Element selectorTwo = new Element.div() |
772 ..classes.add('selector') | 772 ..classes.add('selector') |
773 ..children.add(clickTwo); | 773 ..children.add(clickTwo); |
774 document.body.append(selectorOne); | 774 document.body.append(selectorOne); |
775 document.body.append(selectorTwo); | 775 document.body.append(selectorTwo); |
776 | 776 |
777 document.body.onClick.matches('.selector').listen(expectAsync1( | 777 document.body.onClick.matches('.selector').listen(expectAsync( |
778 (Event event) { | 778 (Event event) { |
779 expect(event.currentTarget, document.body); | 779 expect(event.currentTarget, document.body); |
780 expect(event.target, clickOne); | 780 expect(event.target, clickOne); |
781 expect(event.matchingTarget, selectorOne); | 781 expect(event.matchingTarget, selectorOne); |
782 })); | 782 })); |
783 | 783 |
784 selectorOne.onClick.matches('.selector').listen(expectAsync1( | 784 selectorOne.onClick.matches('.selector').listen(expectAsync( |
785 (Event event) { | 785 (Event event) { |
786 expect(event.currentTarget, selectorOne); | 786 expect(event.currentTarget, selectorOne); |
787 expect(event.target, clickOne); | 787 expect(event.target, clickOne); |
788 expect(event.matchingTarget, selectorOne); | 788 expect(event.matchingTarget, selectorOne); |
789 })); | 789 })); |
790 clickOne.click(); | 790 clickOne.click(); |
791 | 791 |
792 Element elem = new Element.div()..classes.addAll(['a', 'b']); | 792 Element elem = new Element.div()..classes.addAll(['a', 'b']); |
793 Element img = new Element.img() | 793 Element img = new Element.img() |
794 ..classes.addAll(['b', 'a', 'd']) | 794 ..classes.addAll(['b', 'a', 'd']) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 | 969 |
970 test('sublist', () { | 970 test('sublist', () { |
971 var range = makeElementList().sublist(1, 3); | 971 var range = makeElementList().sublist(1, 3); |
972 expect(range.length, 2); | 972 expect(range.length, 2); |
973 expect(range[0], isBRElement); | 973 expect(range[0], isBRElement); |
974 expect(range[1], isBRElement); | 974 expect(range[1], isBRElement); |
975 }); | 975 }); |
976 | 976 |
977 }); | 977 }); |
978 } | 978 } |
OLD | NEW |