| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 5 BSD-style license that can be found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <html> | 7 <html> |
| 8 <!--polymer-test: this comment is needed for test_suite.dart--> |
| 8 <head> | 9 <head> |
| 9 <title>event path</title> | 10 <title>event path</title> |
| 10 <script src="packages/unittest/test_controller.js"></script> | 11 <script src="packages/unittest/test_controller.js"></script> |
| 11 <!-- | 12 <!-- |
| 12 Test ported from: | 13 Test ported from: |
| 13 https://github.com/Polymer/polymer/blob/7936ff8/test/js/events.js | 14 https://github.com/Polymer/polymer/blob/7936ff8/test/js/events.js |
| 14 | 15 |
| 15 TODO(sigmund): when we have support for mutation observers, render all of | 16 TODO(sigmund): when we have support for mutation observers, render all of |
| 16 the test in Dart (like events.js does in JS) | 17 the test in Dart (like events.js does in JS) |
| 17 --> | 18 --> |
| 18 </head> | 19 </head> |
| 19 <body> | 20 <body> |
| 20 | 21 |
| 21 <polymer-element name="test-a" on-click="clickHandler"> | 22 <polymer-element name="test-a" on-click="clickHandler"> |
| 22 <template></template> | 23 <template></template> |
| 23 <script type="application/dart"> | |
| 24 import 'package:polymer/polymer.dart'; | |
| 25 | |
| 26 @CustomTag("test-a") | |
| 27 class TestA extends PolymerElement { | |
| 28 TestA.created() : super.created(); | |
| 29 | |
| 30 List clicks = []; | |
| 31 void clickHandler() { | |
| 32 clicks.add('host click on: $localName (id $id)'); | |
| 33 } | |
| 34 } | |
| 35 </script> | |
| 36 </polymer-element> | 24 </polymer-element> |
| 37 | 25 |
| 38 <polymer-element name="test-b"> | 26 <polymer-element name="test-b"> |
| 39 <template> | 27 <template> |
| 40 <div> | 28 <div> |
| 41 <span id="b-1">1</span> | 29 <span id="b-1">1</span> |
| 42 <span id="b-2" on-click="clickHandler">2</span> | 30 <span id="b-2" on-click="clickHandler">2</span> |
| 43 </div> | 31 </div> |
| 44 </template> | 32 </template> |
| 45 <script type="application/dart"> | |
| 46 import 'package:polymer/polymer.dart'; | |
| 47 | |
| 48 @CustomTag("test-b") | |
| 49 class TestB extends PolymerElement { | |
| 50 TestB.created() : super.created(); | |
| 51 | |
| 52 List clicks = []; | |
| 53 void clickHandler(event, detail, target) { | |
| 54 clicks.add('local click under $localName (id $id) on ${target.id}'); | |
| 55 } | |
| 56 } | |
| 57 </script> | |
| 58 </polymer-element> | 33 </polymer-element> |
| 59 | 34 |
| 60 <test-a id="a"></test-a> | 35 <test-a id="a"></test-a> |
| 61 <test-b id="b"></test-b> | 36 <test-b id="b"></test-b> |
| 62 | 37 |
| 63 <script type="application/dart" src="events_test.dart"></script> | 38 <script type="application/dart" src="events_test.dart"></script> |
| 64 <script type="application/dart" src="packages/polymer/init.dart"></script> | |
| 65 </body> | 39 </body> |
| 66 </html> | 40 </html> |
| OLD | NEW |