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

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

Issue 293023008: Bring back initPolymer, allow boot.js only if using "polymer_experimental.html". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 // 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:html'; 12 import 'dart:html';
13 13
14 import 'package:unittest/unittest.dart'; 14 import 'package:unittest/unittest.dart';
15 import 'package:unittest/html_config.dart'; 15 import 'package:unittest/html_config.dart';
16 import 'package:polymer/polymer.dart'; 16 import 'package:polymer/polymer.dart';
17 17
18 var _observedEvents = []; 18 var _observedEvents = [];
19 var _testFired; 19 var _testFired;
20 20
21 main() => initPolymer();
22
21 @reflectable 23 @reflectable
22 class XZug extends PolymerElement { 24 class XZug extends PolymerElement {
23 25
24 XZug.created() : super.created(); 26 XZug.created() : super.created();
25 27
26 ready() { 28 ready() {
27 shadowRoot.on['test-event'].listen((e) { 29 shadowRoot.on['test-event'].listen((e) {
28 _testFired.complete(null); 30 _testFired.complete(null);
29 }); 31 });
30 } 32 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 72
71 divTestEventHandler(e, detail, sender) { 73 divTestEventHandler(e, detail, sender) {
72 _observedEvents.add(sender); 74 _observedEvents.add(sender);
73 } 75 }
74 76
75 testEventHandler(e, detail, sender) { 77 testEventHandler(e, detail, sender) {
76 _observedEvents.add(sender); 78 _observedEvents.add(sender);
77 } 79 }
78 } 80 }
79 81
80 @initMethod main() { 82 @initMethod init() {
81 useHtmlConfiguration(); 83 useHtmlConfiguration();
82 // TODO(sigmund): switch back to use @CustomTag. We seem to be running into a 84 // TODO(sigmund): switch back to use @CustomTag. We seem to be running into a
83 // problem where using @CustomTag doesn't guarantee that we register the tags 85 // problem where using @CustomTag doesn't guarantee that we register the tags
84 // in the following order (the query from mirrors is non deterministic). 86 // in the following order (the query from mirrors is non deterministic).
85 // We shouldn't care about registration order though. See dartbug.com/14459 87 // We shouldn't care about registration order though. See dartbug.com/14459
86 Polymer.register('x-zug', XZug); 88 Polymer.register('x-zug', XZug);
87 Polymer.register('x-foo', XFoo); 89 Polymer.register('x-foo', XFoo);
88 Polymer.register('x-bar', XBar); 90 Polymer.register('x-bar', XBar);
89 91
90 _testFired = new Completer(); 92 _testFired = new Completer();
(...skipping 16 matching lines...) Expand all
107 var expectedPath = [ xBarContent, xBarDiv, xFooContent, 109 var expectedPath = [ xBarContent, xBarDiv, xFooContent,
108 xZugContent, xZugDiv, xZug, xFooDiv, xFoo, xBar]; 110 xZugContent, xZugDiv, xZug, xFooDiv, xFoo, xBar];
109 debugName(e) => '${e.localName}#${e.id}'; 111 debugName(e) => '${e.localName}#${e.id}';
110 expect(_observedEvents, expectedPath, reason: 112 expect(_observedEvents, expectedPath, reason:
111 '<br>\nexpected: ${expectedPath.map(debugName).join(',')}' 113 '<br>\nexpected: ${expectedPath.map(debugName).join(',')}'
112 '<br>\nactual: ${_observedEvents.map(debugName).join(',')}' 114 '<br>\nactual: ${_observedEvents.map(debugName).join(',')}'
113 ); 115 );
114 }); 116 });
115 }); 117 });
116 } 118 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/event_handlers_test.html ('k') | pkg/polymer/test/event_path_declarative_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698