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

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

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 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 | « packages/polymer/test/event_path_declarative_test.html ('k') | packages/polymer/test/event_path_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/polymer/test/event_path_test.dart
diff --git a/packages/polymer/test/event_path_test.dart b/packages/polymer/test/event_path_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7d61926004efd6baa094546b4fe8a07a48a9ce1e
--- /dev/null
+++ b/packages/polymer/test/event_path_test.dart
@@ -0,0 +1,79 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library polymer.test.web.event_path_test;
+
+import 'dart:html';
+import 'package:polymer/polymer.dart';
+import 'package:unittest/html_config.dart';
+import 'package:unittest/unittest.dart';
+
+@CustomTag('x-selector')
+class XSelector extends PolymerElement {
+ XSelector.created() : super.created();
+}
+
+@CustomTag('x-overlay')
+class XOverlay extends PolymerElement {
+ XOverlay.created() : super.created();
+}
+
+@CustomTag('x-menu')
+class XMenu extends XSelector {
+ XMenu.created() : super.created();
+}
+
+@CustomTag('x-menu-button')
+class XMenuButton extends PolymerElement {
+ XMenuButton.created() : super.created();
+}
+
+main() => initPolymer().then((zone) => zone.run(() {
+ useHtmlConfiguration();
+
+ setUp(() => Polymer.onReady);
+
+ test('bubbling in the right order', () {
+ var item1 = querySelector('#item1');
+ var menuButton = querySelector('#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.querySelector('#menu');
+ var overlay = menuButton.shadowRoot.querySelector('#overlay');
+ var expectedPath = <Node>[
+ item1,
+ menuButton.shadowRoot.querySelector('#menuButtonContent'),
+ menu.shadowRoot.olderShadowRoot.querySelector('#selectorContent'),
+ menu.shadowRoot.olderShadowRoot.querySelector('#selectorDiv'),
+ menu.shadowRoot.olderShadowRoot,
+ menu.shadowRoot.querySelector('#menuShadow'),
+ menu.shadowRoot.querySelector('#menuDiv'),
+ menu.shadowRoot,
+ menu,
+ menuButton.shadowRoot.querySelector('#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(expectAsync((e) {
+ expect(e.currentTarget, node);
+ expect(x++, i);
+ }));
+ }
+
+ item1.dispatchEvent(new Event('x', canBubble: true));
+ });
+}));
« no previous file with comments | « packages/polymer/test/event_path_declarative_test.html ('k') | packages/polymer/test/event_path_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698