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

Side by Side Diff: pkg/polymer/test/event_path_test.dart

Issue 24324005: Updating Shadow DOM and including some fixes to enable it to work with CustomElements. (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 | « pkg/pkg.status ('k') | pkg/polymer/test/event_path_test.html » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 polymer.test.web.event_path_test; 5 library polymer.test.web.event_path_test;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
11 11
12 main() { 12 main() {
13 useHtmlConfiguration(); 13 useHtmlConfiguration();
14 test('bubbling in the right order', () { 14 test('bubbling in the right order', () {
15 // TODO(sigmund): this should change once we port over the 15 // TODO(sigmund): this should change once we port over the
16 // 'WebComponentsReady' event. 16 // 'WebComponentsReady' event.
17 runAsync(expectAsync0(() { 17 return new Future.delayed(Duration.ZERO).then((_) {
18 var item1 = query('#item1'); 18 var item1 = query('#item1');
19 var menuButton = query('#menuButton'); 19 var menuButton = query('#menuButton');
20 // Note: polymer uses automatic node finding (menuButton.$.menu) 20 // Note: polymer uses automatic node finding (menuButton.$.menu)
21 // also note that their node finding code also reachs into the ids 21 // also note that their node finding code also reachs into the ids
22 // from the parent shadow (menu.$.selectorContent instead of 22 // from the parent shadow (menu.$.selectorContent instead of
23 // menu.$.menuShadow.$.selectorContent) 23 // menu.$.menuShadow.$.selectorContent)
24 var menu = menuButton.shadowRoot.query('#menu'); 24 var menu = menuButton.shadowRoot.query('#menu');
25 var selector = menu.shadowRoot.query("#menuShadow");
26 var overlay = menuButton.shadowRoot.query('#overlay'); 25 var overlay = menuButton.shadowRoot.query('#overlay');
27 var expectedPath = <Node>[ 26 var expectedPath = <Node>[
28 item1, 27 item1,
29 menuButton.shadowRoot.query('#menuButtonContent'), 28 menuButton.shadowRoot.query('#menuButtonContent'),
30 selector.olderShadowRoot.query('#selectorContent'), 29 menu.shadowRoot.olderShadowRoot.query('#selectorContent'),
31 selector.olderShadowRoot.query('#selectorDiv'), 30 menu.shadowRoot.olderShadowRoot.query('#selectorDiv'),
32 menu.shadowRoot.query('#menuShadow').olderShadowRoot, 31 menu.shadowRoot.olderShadowRoot,
33 menu.shadowRoot.query('#menuShadow'), 32 menu.shadowRoot.query('#menuShadow'),
34 menu.shadowRoot.query('#menuDiv'), 33 menu.shadowRoot.query('#menuDiv'),
35 menu.shadowRoot, 34 menu.shadowRoot,
36 menu, 35 menu,
37 menuButton.shadowRoot.query('#menuButtonDiv'), 36 menuButton.shadowRoot.query('#menuButtonDiv'),
38 // TODO(sigmund): this test is currently broken because currently 37 // TODO(sigmund): this test is currently broken because currently
39 // registerElement is sensitive to the order in which each custom 38 // registerElement is sensitive to the order in which each custom
40 // element is registered. When fixed, we should be able to add the 39 // element is registered. When fixed, we should be able to add the
41 // following three targets: 40 // following three targets:
42 // overlay.shadowRoot.query('#overlayContent'), 41 // overlay.shadowRoot.query('#overlayContent'),
43 // overlay.shadowRoot, 42 // overlay.shadowRoot,
44 // overlay, 43 // overlay,
45 menuButton.shadowRoot, 44 menuButton.shadowRoot,
46 menuButton 45 menuButton
47 ]; 46 ];
48 var x = 0; 47 var x = 0;
49 for (int i = 0; i < expectedPath.length; i++) { 48 for (int i = 0; i < expectedPath.length; i++) {
50 var node = expectedPath[i]; 49 var node = expectedPath[i];
51 expect(node, isNotNull, reason: "Should not be null at $i"); 50 expect(node, isNotNull, reason: "Should not be null at $i");
52 node.on['x'].listen(expectAsync1((e) { 51 node.on['x'].listen(expectAsync1((e) {
53 expect(e.currentTarget, node); 52 expect(e.currentTarget, node);
54 expect(x++, i); 53 expect(x++, i);
55 })); 54 }));
56 } 55 }
57 56
58 item1.dispatchEvent(new Event('x', canBubble: true)); 57 item1.dispatchEvent(new Event('x', canBubble: true));
59 })); 58 });
60 }); 59 });
61 } 60 }
OLDNEW
« no previous file with comments | « pkg/pkg.status ('k') | pkg/polymer/test/event_path_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698