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

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

Issue 307793002: update polymer, nodebind, and templatebinding (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/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/pubspec.yaml ('k') | pkg/polymer/test/auto_binding_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/auto_binding_test.dart
diff --git a/pkg/polymer/test/auto_binding_test.dart b/pkg/polymer/test/auto_binding_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b563814516a79a91a594554cb24f79245e615da1
--- /dev/null
+++ b/pkg/polymer/test/auto_binding_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:html';
+import 'package:polymer/auto_binding.dart';
+import 'package:polymer/polymer.dart';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+
+class TestModel {
+ var greeting = 'Hi';
+ eventAction(e) {
+ e.detail.add('handled');
+ }
+}
+
+main() => initPolymer().run(() {
+ useHtmlConfiguration();
+
+ setUp(() => Polymer.onReady);
+
+ test('elements upgraded', () {
+ AutoBindingElement template = document.getElementById('one');
+ template.model = new TestModel();
+
+ var completer = new Completer();
+ var events = 0;
+ window.addEventListener('template-bound', (e) {
+ events++;
+ if (e.target.id == 'one') {
+ expect(e.target, template);
+
+ var t = template;
+ var h = t.$['h'];
+ expect(h.text, t.model.greeting, reason: 'binding applied');
+ var ce = t.fire('tap', onNode: h, detail: []);
+ expect(ce.detail, ['handled'], reason: 'element event handler fired');
+ }
+
+ if (events == 2) completer.complete();
+ });
+
+ return completer.future;
+ });
+});
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | pkg/polymer/test/auto_binding_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698