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

Side by Side Diff: pkg/polymer/test/custom_event_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 library polymer.test.web.custom_event_test; 5 library polymer.test.web.custom_event_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
10 import 'package:template_binding/template_binding.dart' show nodeBind; 10 import 'package:template_binding/template_binding.dart' show nodeBind;
(...skipping 24 matching lines...) Expand all
35 class TestCustomEvent extends PolymerElement { 35 class TestCustomEvent extends PolymerElement {
36 TestCustomEvent.created() : super.created(); 36 TestCustomEvent.created() : super.created();
37 37
38 get fooBar => getShadowRoot('test-custom-event').querySelector('foo-bar'); 38 get fooBar => getShadowRoot('test-custom-event').querySelector('foo-bar');
39 39
40 final events = []; 40 final events = [];
41 fooHandler(e) => events.add(['foo', e]); 41 fooHandler(e) => events.add(['foo', e]);
42 barBazHandler(e) => events.add(['barbaz', e]); 42 barBazHandler(e) => events.add(['barbaz', e]);
43 } 43 }
44 44
45 @initMethod 45 main() => initPolymer().run(() {
46 main() {
47 useHtmlConfiguration(); 46 useHtmlConfiguration();
48 47
49 setUp(() => Polymer.onReady); 48 setUp(() => Polymer.onReady);
50 49
51 test('custom event', () { 50 test('custom event', () {
52 final testComp = querySelector('test-custom-event'); 51 final testComp = querySelector('test-custom-event');
53 final fooBar = testComp.fooBar; 52 final fooBar = testComp.fooBar;
54 53
55 final binding = nodeBind(fooBar).bindings['on-barbaz']; 54 final binding = nodeBind(fooBar).bindings['on-barbaz'];
56 expect(binding is Bindable, true, 55 expect(binding is Bindable, true,
57 reason: 'on-barbaz event should be bound'); 56 reason: 'on-barbaz event should be bound');
58 57
59 expect(binding.value, null, reason: 'event bindings do not have value'); 58 expect(binding.value, null, reason: 'event bindings do not have value');
60 59
61 fooBar.fireFoo(123); 60 fooBar.fireFoo(123);
62 fooBar.fireBarBaz(42); 61 fooBar.fireBarBaz(42);
63 fooBar.fireFoo(777); 62 fooBar.fireFoo(777);
64 63
65 final events = testComp.events; 64 final events = testComp.events;
66 expect(events.length, 3); 65 expect(events.length, 3);
67 expect(events.map((e) => e[0]), ['foo', 'barbaz', 'foo']); 66 expect(events.map((e) => e[0]), ['foo', 'barbaz', 'foo']);
68 expect(events.map((e) => e[1].detail), [123, 42, 777]); 67 expect(events.map((e) => e[1].detail), [123, 42, 777]);
69 }); 68 });
70 } 69 });
OLDNEW
« no previous file with comments | « pkg/polymer/test/build/script_compactor_test.dart ('k') | pkg/polymer/test/custom_event_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698