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 // This is ported from event-path-declarative-test.dart in polymer/test/html/. | 5 // This is ported from event-path-declarative-test.dart in polymer/test/html/. |
6 // While the original test was intended to test event.path support, we changed | 6 // While the original test was intended to test event.path support, we changed |
7 // the test structure just to check that the event was handled in the expected | 7 // the test structure just to check that the event was handled in the expected |
8 // order. | 8 // order. |
9 library polymer.test.event_path_declarative_test; | 9 library polymer.test.event_path_declarative_test; |
10 | 10 |
11 import 'dart:async'; | 11 import 'dart:async'; |
12 import 'dart:collection'; | |
13 import 'dart:html'; | 12 import 'dart:html'; |
14 | 13 |
15 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
16 import 'package:unittest/html_config.dart'; | 15 import 'package:unittest/html_config.dart'; |
17 import 'package:polymer/polymer.dart'; | 16 import 'package:polymer/polymer.dart'; |
18 import 'package:template_binding/template_binding.dart'; | |
19 | 17 |
20 var _observedEvents = []; | 18 var _observedEvents = []; |
21 var _testFired; | 19 var _testFired; |
22 | 20 |
23 main() => initPolymer(); | 21 main() => initPolymer(); |
24 | 22 |
25 @reflectable | 23 @reflectable |
26 class XZug extends PolymerElement { | 24 class XZug extends PolymerElement { |
27 | 25 |
28 XZug.created() : super.created(); | 26 XZug.created() : super.created(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 var expectedPath = [ xBarContent, xBarDiv, xFooContent, | 109 var expectedPath = [ xBarContent, xBarDiv, xFooContent, |
112 xZugContent, xZugDiv, xZug, xFooDiv, xFoo, xBar]; | 110 xZugContent, xZugDiv, xZug, xFooDiv, xFoo, xBar]; |
113 debugName(e) => '${e.localName}#${e.id}'; | 111 debugName(e) => '${e.localName}#${e.id}'; |
114 expect(_observedEvents, expectedPath, reason: | 112 expect(_observedEvents, expectedPath, reason: |
115 '<br>\nexpected: ${expectedPath.map(debugName).join(',')}' | 113 '<br>\nexpected: ${expectedPath.map(debugName).join(',')}' |
116 '<br>\nactual: ${_observedEvents.map(debugName).join(',')}' | 114 '<br>\nactual: ${_observedEvents.map(debugName).join(',')}' |
117 ); | 115 ); |
118 }); | 116 }); |
119 }); | 117 }); |
120 } | 118 } |
OLD | NEW |