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

Unified Diff: pkg/polymer/test/custom_event_test.dart

Issue 335943003: merge to trunk all changes from 36817 until 37378 under the packages: polymer, (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/custom_event_test.dart
===================================================================
--- pkg/polymer/test/custom_event_test.dart (revision 37373)
+++ pkg/polymer/test/custom_event_test.dart (working copy)
@@ -7,7 +7,8 @@
import 'dart:async';
import 'dart:html';
import 'package:polymer/polymer.dart';
-import 'package:template_binding/template_binding.dart' show nodeBind;
+import 'package:template_binding/template_binding.dart'
+ show nodeBind, enableBindingsReflection;
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';
@@ -35,35 +36,40 @@
class TestCustomEvent extends PolymerElement {
TestCustomEvent.created() : super.created();
- get fooBar => getShadowRoot('test-custom-event').querySelector('foo-bar');
+ get fooBar => shadowRoots['test-custom-event'].querySelector('foo-bar');
final events = [];
fooHandler(e) => events.add(['foo', e]);
barBazHandler(e) => events.add(['barbaz', e]);
}
-main() => initPolymer().run(() {
- useHtmlConfiguration();
+main() {
+ enableBindingsReflection = true;
- setUp(() => Polymer.onReady);
+ initPolymer().run(() {
+ useHtmlConfiguration();
- test('custom event', () {
- final testComp = querySelector('test-custom-event');
- final fooBar = testComp.fooBar;
+ setUp(() => Polymer.onReady);
- final binding = nodeBind(fooBar).bindings['on-barbaz'];
- expect(binding is Bindable, true,
- reason: 'on-barbaz event should be bound');
+ test('custom event', () {
+ final testComp = querySelector('test-custom-event');
+ final fooBar = testComp.fooBar;
- expect(binding.value, null, reason: 'event bindings do not have value');
+ final binding = nodeBind(fooBar).bindings['on-barbaz'];
+ expect(binding is Bindable, true,
+ reason: 'on-barbaz event should be bound');
- fooBar.fireFoo(123);
- fooBar.fireBarBaz(42);
- fooBar.fireFoo(777);
+ expect(binding.value, '{{ barBazHandler }}',
+ reason: 'event bindings use the string as value');
- final events = testComp.events;
- expect(events.length, 3);
- expect(events.map((e) => e[0]), ['foo', 'barbaz', 'foo']);
- expect(events.map((e) => e[1].detail), [123, 42, 777]);
+ fooBar.fireFoo(123);
+ fooBar.fireBarBaz(42);
+ fooBar.fireFoo(777);
+
+ final events = testComp.events;
+ expect(events.length, 3);
+ expect(events.map((e) => e[0]), ['foo', 'barbaz', 'foo']);
+ expect(events.map((e) => e[1].detail), [123, 42, 777]);
+ });
});
-});
+}
« 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