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

Side by Side Diff: pkg/polymer/test/data/unit/event_path_test.html

Issue 23224003: move polymer.dart into dart svn (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add --deploy to todomvc sample Created 7 years, 4 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/polymer/test/css_test.dart ('k') | pkg/polymer/test/data/unit/events_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
(Empty)
1 <!doctype html>
2 <!--
3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 for details. All rights reserved. Use of this source code is governed by a
5 BSD-style license that can be found in the LICENSE file.
6 -->
7 <html>
8 <head>
9 <title>event path</title>
10 <script src="packages/polymer/testing/testing.js"></script>
11 <script src="packages/unittest/test_controller.js"></script>
12 <!--
13 Test ported from:
14 https://github.com/Polymer/polymer/blob/7936ff8/test/html/event-path.html
15
16 This test actually doesn't test the polymer's event layer. It just ensures
17 that tests are propagated in the right order when using Shadow DOM.
18 -->
19 </head>
20 <body>
21
22 <polymer-element name="x-selector">
23 <template>
24 <div id="selectorDiv">
25 <content id="selectorContent"></content>
26 </div>
27 </template>
28 <script type="application/dart">
29 import 'package:polymer/polymer.dart';
30 @CustomTag("x-selector")
31 class XSelector extends PolymerElement {}
32 </script>
33 </polymer-element>
34
35 <polymer-element name="x-overlay">
36 <template>
37 <content id="overlayContent"></content>
38 </template>
39 <script type="application/dart">
40 import 'package:polymer/polymer.dart';
41 @CustomTag("x-overlay")
42 class XOverlay extends PolymerElement {}
43 </script>
44 </polymer-element>
45
46 <polymer-element name="x-menu" extends="x-selector">
47 <template>
48 <div id="menuDiv">
49 <shadow id="menuShadow"></shadow>
50 </div>
51 </template>
52 <script type="application/dart">
53 import 'package:polymer/polymer.dart';
54 @CustomTag("x-menu")
55 class XMenu extends PolymerElement {}
56 </script>
57 </polymer-element>
58
59 <polymer-element name="x-menu-button">
60 <template>
61 <div>
62 <x-overlay id="overlay">
63 <div id="menuButtonDiv">
64 <x-menu id="menu">
65 <content id="menuButtonContent"></content>
66 </x-menu>
67 </div>
68 </x-overlay>
69 </div>
70 </template>
71 <script type="application/dart">
72 import 'package:polymer/polymer.dart';
73 @CustomTag("x-menu-button")
74 class XMenuButton extends PolymerElement {}
75 </script>
76 </polymer-element>
77
78 <x-menu-button id="menuButton">
79 <div id="item1"><div id="source"></div>Item1</div>
80 <div id="item2">Item2</div>
81 </x-menu-button>
82
83
84 <script type="application/dart">
85 import 'dart:html';
86 import 'dart:async';
87 import 'package:unittest/unittest.dart';
88 import 'package:unittest/html_config.dart';
89
90 main() {
91 useHtmlConfiguration();
92 test('bubbling in the right order', () {
93 // TODO(sigmund): this should change once we port over the
94 // 'WebComponentsReady' event.
95 runAsync(expectAsync0(() {
96 var item1 = query('#item1');
97 var menuButton = query('#menuButton');
98 // Note: polymer uses automatic node finding (menuButton.$.menu)
99 // also note that their node finding code also reachs into the ids
100 // from the parent shadow (menu.$.selectorContent instead of
101 // menu.$.menuShadow.$.selectorContent)
102 var menu = menuButton.shadowRoot.query('#menu');
103 var selector = menu.shadowRoot.query("#menuShadow");
104 var overlay = menuButton.shadowRoot.query('#overlay');
105 var expectedPath = <Node>[
106 item1,
107 menuButton.shadowRoot.query('#menuButtonContent'),
108 selector.olderShadowRoot.query('#selectorContent'),
109 selector.olderShadowRoot.query('#selectorDiv'),
110 menu.shadowRoot.query('#menuShadow').olderShadowRoot,
111 menu.shadowRoot.query('#menuShadow'),
112 menu.shadowRoot.query('#menuDiv'),
113 menu.shadowRoot,
114 menu,
115 menuButton.shadowRoot.query('#menuButtonDiv'),
116 // TODO(sigmund): this test is currently broken because currently
117 // registerElement is sensitive to the order in which each custom
118 // element is registered. When fixed, we should be able to add the
119 // following three targets:
120 // overlay.shadowRoot.query('#overlayContent'),
121 // overlay.shadowRoot,
122 // overlay,
123 menuButton.shadowRoot,
124 menuButton
125 ];
126 var x = 0;
127 for (int i = 0; i < expectedPath.length; i++) {
128 var node = expectedPath[i];
129 expect(node, isNotNull, reason: "Should not be null at $i");
130 node.on['x'].listen(expectAsync1((e) {
131 expect(e.currentTarget, node);
132 expect(x++, i);
133 }));
134 }
135
136 item1.dispatchEvent(new Event('x', canBubble: true));
137 }));
138 });
139 }
140 </script>
141 </body>
142 </html>
OLDNEW
« no previous file with comments | « pkg/polymer/test/css_test.dart ('k') | pkg/polymer/test/data/unit/events_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698