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

Unified Diff: pkg/polymer/test/event_path_test.dart

Issue 27307004: Converting Polymer's WebComponentsLoaded to an onReady future (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/lib/src/loader.dart ('k') | pkg/polymer/test/events_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/event_path_test.dart
diff --git a/pkg/polymer/test/event_path_test.dart b/pkg/polymer/test/event_path_test.dart
index 3037822b5d0b82da3a2e67e96aefe1a5e7969fa6..660566a81a27fa69fc38b6a98fe30200339c3a2f 100644
--- a/pkg/polymer/test/event_path_test.dart
+++ b/pkg/polymer/test/event_path_test.dart
@@ -5,56 +5,55 @@
library polymer.test.web.event_path_test;
import 'dart:html';
-import 'dart:async';
-import 'package:unittest/unittest.dart';
+import 'package:polymer/polymer.dart';
import 'package:unittest/html_config.dart';
+import 'package:unittest/unittest.dart';
main() {
useHtmlConfiguration();
+
+ setUp(() => Polymer.onReady);
+
test('bubbling in the right order', () {
- // TODO(sigmund): this should change once we port over the
- // 'WebComponentsReady' event.
- return new Future.delayed(Duration.ZERO).then((_) {
- var item1 = query('#item1');
- var menuButton = query('#menuButton');
- // Note: polymer uses automatic node finding (menuButton.$.menu)
- // also note that their node finding code also reachs into the ids
- // from the parent shadow (menu.$.selectorContent instead of
- // menu.$.menuShadow.$.selectorContent)
- var menu = menuButton.shadowRoot.query('#menu');
- var overlay = menuButton.shadowRoot.query('#overlay');
- var expectedPath = <Node>[
- item1,
- menuButton.shadowRoot.query('#menuButtonContent'),
- menu.shadowRoot.olderShadowRoot.query('#selectorContent'),
- menu.shadowRoot.olderShadowRoot.query('#selectorDiv'),
- menu.shadowRoot.olderShadowRoot,
- menu.shadowRoot.query('#menuShadow'),
- menu.shadowRoot.query('#menuDiv'),
- menu.shadowRoot,
- menu,
- menuButton.shadowRoot.query('#menuButtonDiv'),
- // TODO(sigmund): this test is currently broken because currently
- // registerElement is sensitive to the order in which each custom
- // element is registered. When fixed, we should be able to add the
- // following three targets:
- // overlay.shadowRoot.query('#overlayContent'),
- // overlay.shadowRoot,
- // overlay,
- menuButton.shadowRoot,
- menuButton
- ];
- var x = 0;
- for (int i = 0; i < expectedPath.length; i++) {
- var node = expectedPath[i];
- expect(node, isNotNull, reason: "Should not be null at $i");
- node.on['x'].listen(expectAsync1((e) {
- expect(e.currentTarget, node);
- expect(x++, i);
- }));
- }
+ var item1 = query('#item1');
+ var menuButton = query('#menuButton');
+ // Note: polymer uses automatic node finding (menuButton.$.menu)
+ // also note that their node finding code also reachs into the ids
+ // from the parent shadow (menu.$.selectorContent instead of
+ // menu.$.menuShadow.$.selectorContent)
+ var menu = menuButton.shadowRoot.query('#menu');
+ var overlay = menuButton.shadowRoot.query('#overlay');
+ var expectedPath = <Node>[
+ item1,
+ menuButton.shadowRoot.query('#menuButtonContent'),
+ menu.shadowRoot.olderShadowRoot.query('#selectorContent'),
+ menu.shadowRoot.olderShadowRoot.query('#selectorDiv'),
+ menu.shadowRoot.olderShadowRoot,
+ menu.shadowRoot.query('#menuShadow'),
+ menu.shadowRoot.query('#menuDiv'),
+ menu.shadowRoot,
+ menu,
+ menuButton.shadowRoot.query('#menuButtonDiv'),
+ // TODO(sigmund): this test is currently broken because currently
+ // registerElement is sensitive to the order in which each custom
+ // element is registered. When fixed, we should be able to add the
+ // following three targets:
+ // overlay.shadowRoot.query('#overlayContent'),
+ // overlay.shadowRoot,
+ // overlay,
+ menuButton.shadowRoot,
+ menuButton
+ ];
+ var x = 0;
+ for (int i = 0; i < expectedPath.length; i++) {
+ var node = expectedPath[i];
+ expect(node, isNotNull, reason: "Should not be null at $i");
+ node.on['x'].listen(expectAsync1((e) {
+ expect(e.currentTarget, node);
+ expect(x++, i);
+ }));
+ }
- item1.dispatchEvent(new Event('x', canBubble: true));
- });
+ item1.dispatchEvent(new Event('x', canBubble: true));
});
}
« no previous file with comments | « pkg/polymer/lib/src/loader.dart ('k') | pkg/polymer/test/events_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698