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

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

Issue 26722002: Add "matchingTarget" function to Event, which is the Element that matched the CSS value selector. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/EventStreamProvider.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 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 test('sublist', () { 745 test('sublist', () {
746 var range = makeElList().sublist(1, 3); 746 var range = makeElList().sublist(1, 3);
747 expect(range, isElementList); 747 expect(range, isElementList);
748 expect(range[0], isImageElement); 748 expect(range[0], isImageElement);
749 expect(range[1], isInputElement); 749 expect(range[1], isInputElement);
750 }); 750 });
751 }); 751 });
752 752
753 group('eventDelegation', () { 753 group('eventDelegation', () {
754 test('matches', () { 754 test('matches', () {
755 Element clickOne = new Element.a();
756 Element selectorOne = new Element.div()
757 ..classes.add('selector')
758 ..children.add(clickOne);
759
760 Element clickTwo = new Element.a();
761 Element selectorTwo = new Element.div()
762 ..classes.add('selector')
763 ..children.add(clickTwo);
764 document.body.append(selectorOne);
765 document.body.append(selectorTwo);
766
767 document.body.onClick.matches('.selector').listen(expectAsync1(
768 (Event event) {
769 expect(event.currentTarget, document.body);
770 expect(event.target, clickOne);
771 expect(event.matchingTarget, selectorOne);
772 }));
773 clickOne.click();
774
755 Element elem = new Element.div()..classes.addAll(['a', 'b']); 775 Element elem = new Element.div()..classes.addAll(['a', 'b']);
756 Element img = new Element.img() 776 Element img = new Element.img()
757 ..classes.addAll(['b', 'a', 'd']) 777 ..classes.addAll(['b', 'a', 'd'])
758 ..id = 'cookie'; 778 ..id = 'cookie';
759 Element input = new InputElement()..classes.addAll(['c', 'd']); 779 Element input = new InputElement()..classes.addAll(['c', 'd']);
760 var div = new Element.div() 780 var div = new Element.div()
761 ..classes.add('a') 781 ..classes.add('a')
762 ..id = 'wat'; 782 ..id = 'wat';
763 document.body.append(elem); 783 document.body.append(elem);
764 document.body.append(img); 784 document.body.append(img);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 915
896 test('sublist', () { 916 test('sublist', () {
897 var range = makeElementList().sublist(1, 3); 917 var range = makeElementList().sublist(1, 3);
898 expect(range.length, 2); 918 expect(range.length, 2);
899 expect(range[0], isBRElement); 919 expect(range[0], isBRElement);
900 expect(range[1], isBRElement); 920 expect(range[1], isBRElement);
901 }); 921 });
902 922
903 }); 923 });
904 } 924 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/EventStreamProvider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698