| OLD | NEW |
| 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'; |
| 11 | 11 |
| 12 @initMethod _main() { | 12 @CustomTag("x-selector") |
| 13 class XSelector extends PolymerElement { |
| 14 XSelector.created() : super.created(); |
| 15 } |
| 16 |
| 17 @CustomTag("x-overlay") |
| 18 class XOverlay extends PolymerElement { |
| 19 XOverlay.created() : super.created(); |
| 20 } |
| 21 |
| 22 @CustomTag("x-menu") |
| 23 class XMenu extends PolymerElement { |
| 24 XMenu.created() : super.created(); |
| 25 } |
| 26 |
| 27 @CustomTag("x-menu-button") |
| 28 class XMenuButton extends PolymerElement { |
| 29 XMenuButton.created() : super.created(); |
| 30 } |
| 31 |
| 32 main() { |
| 33 initPolymer(); |
| 13 useHtmlConfiguration(); | 34 useHtmlConfiguration(); |
| 14 | 35 |
| 15 setUp(() => Polymer.onReady); | 36 setUp(() => Polymer.onReady); |
| 16 | 37 |
| 17 test('bubbling in the right order', () { | 38 test('bubbling in the right order', () { |
| 18 var item1 = query('#item1'); | 39 var item1 = query('#item1'); |
| 19 var menuButton = query('#menuButton'); | 40 var menuButton = query('#menuButton'); |
| 20 // Note: polymer uses automatic node finding (menuButton.$.menu) | 41 // Note: polymer uses automatic node finding (menuButton.$.menu) |
| 21 // 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 |
| 22 // from the parent shadow (menu.$.selectorContent instead of | 43 // from the parent shadow (menu.$.selectorContent instead of |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 expect(node, isNotNull, reason: "Should not be null at $i"); | 71 expect(node, isNotNull, reason: "Should not be null at $i"); |
| 51 node.on['x'].listen(expectAsync1((e) { | 72 node.on['x'].listen(expectAsync1((e) { |
| 52 expect(e.currentTarget, node); | 73 expect(e.currentTarget, node); |
| 53 expect(x++, i); | 74 expect(x++, i); |
| 54 })); | 75 })); |
| 55 } | 76 } |
| 56 | 77 |
| 57 item1.dispatchEvent(new Event('x', canBubble: true)); | 78 item1.dispatchEvent(new Event('x', canBubble: true)); |
| 58 }); | 79 }); |
| 59 } | 80 } |
| OLD | NEW |