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

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

Issue 172923002: [polymer] fix editor hints -- query/queryAll and unused imports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
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 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 import 'package:unittest/html_config.dart'; 9 import 'package:unittest/html_config.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 18 matching lines...) Expand all
29 XMenuButton.created() : super.created(); 29 XMenuButton.created() : super.created();
30 } 30 }
31 31
32 main() { 32 main() {
33 initPolymer(); 33 initPolymer();
34 useHtmlConfiguration(); 34 useHtmlConfiguration();
35 35
36 setUp(() => Polymer.onReady); 36 setUp(() => Polymer.onReady);
37 37
38 test('bubbling in the right order', () { 38 test('bubbling in the right order', () {
39 var item1 = query('#item1'); 39 var item1 = querySelector('#item1');
40 var menuButton = query('#menuButton'); 40 var menuButton = querySelector('#menuButton');
41 // Note: polymer uses automatic node finding (menuButton.$.menu) 41 // Note: polymer uses automatic node finding (menuButton.$.menu)
42 // also note that their node finding code also reachs into the ids 42 // also note that their node finding code also reachs into the ids
43 // from the parent shadow (menu.$.selectorContent instead of 43 // from the parent shadow (menu.$.selectorContent instead of
44 // menu.$.menuShadow.$.selectorContent) 44 // menu.$.menuShadow.$.selectorContent)
45 var menu = menuButton.shadowRoot.query('#menu'); 45 var menu = menuButton.shadowRoot.querySelector('#menu');
46 var overlay = menuButton.shadowRoot.query('#overlay'); 46 var overlay = menuButton.shadowRoot.querySelector('#overlay');
47 var expectedPath = <Node>[ 47 var expectedPath = <Node>[
48 item1, 48 item1,
49 menuButton.shadowRoot.query('#menuButtonContent'), 49 menuButton.shadowRoot.querySelector('#menuButtonContent'),
50 menu.shadowRoot.olderShadowRoot.query('#selectorContent'), 50 menu.shadowRoot.olderShadowRoot.querySelector('#selectorContent'),
51 menu.shadowRoot.olderShadowRoot.query('#selectorDiv'), 51 menu.shadowRoot.olderShadowRoot.querySelector('#selectorDiv'),
52 menu.shadowRoot.olderShadowRoot, 52 menu.shadowRoot.olderShadowRoot,
53 menu.shadowRoot.query('#menuShadow'), 53 menu.shadowRoot.querySelector('#menuShadow'),
54 menu.shadowRoot.query('#menuDiv'), 54 menu.shadowRoot.querySelector('#menuDiv'),
55 menu.shadowRoot, 55 menu.shadowRoot,
56 menu, 56 menu,
57 menuButton.shadowRoot.query('#menuButtonDiv'), 57 menuButton.shadowRoot.querySelector('#menuButtonDiv'),
58 // TODO(sigmund): this test is currently broken because currently 58 // TODO(sigmund): this test is currently broken because currently
59 // registerElement is sensitive to the order in which each custom 59 // registerElement is sensitive to the order in which each custom
60 // element is registered. When fixed, we should be able to add the 60 // element is registered. When fixed, we should be able to add the
61 // following three targets: 61 // following three targets:
62 // overlay.shadowRoot.query('#overlayContent'), 62 // overlay.shadowRoot.query('#overlayContent'),
63 // overlay.shadowRoot, 63 // overlay.shadowRoot,
64 // overlay, 64 // overlay,
65 menuButton.shadowRoot, 65 menuButton.shadowRoot,
66 menuButton 66 menuButton
67 ]; 67 ];
68 var x = 0; 68 var x = 0;
69 for (int i = 0; i < expectedPath.length; i++) { 69 for (int i = 0; i < expectedPath.length; i++) {
70 var node = expectedPath[i]; 70 var node = expectedPath[i];
71 expect(node, isNotNull, reason: "Should not be null at $i"); 71 expect(node, isNotNull, reason: "Should not be null at $i");
72 node.on['x'].listen(expectAsync1((e) { 72 node.on['x'].listen(expectAsync((e) {
73 expect(e.currentTarget, node); 73 expect(e.currentTarget, node);
74 expect(x++, i); 74 expect(x++, i);
75 })); 75 }));
76 } 76 }
77 77
78 item1.dispatchEvent(new Event('x', canBubble: true)); 78 item1.dispatchEvent(new Event('x', canBubble: true));
79 }); 79 });
80 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698