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

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

Issue 25740006: port polymer data binding tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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/bind_mdv_test.dart ('k') | pkg/polymer/test/bind_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/bind_test.dart
diff --git a/pkg/polymer/test/bind_test.dart b/pkg/polymer/test/bind_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2e726ccd7eb4ce457cf479056e5d2a6a9154e126
--- /dev/null
+++ b/pkg/polymer/test/bind_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2013, 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/polymer.dart';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:unittest/matcher.dart';
+
+@CustomTag('x-foo')
+class XFoo extends PolymerElement {
+ @observable var foo = 'foo!';
+ final _ready = new Completer();
+ Future onTestDone;
+
+ XFoo.created() : super.created() {
+ onTestDone = _ready.future.then(_runTest);
+ }
+
+ _runTest(_) {
+ expect(foo, $['foo'].attributes['foo']);
+ expect($['bool'].attributes['foo'], '');
+ expect($['bool'].attributes, isNot(contains('foo?')));
+ expect($['content'].innerHtml, foo);
+
+ expect(foo, $['bar'].attributes['foo']);
+ expect($['barBool'].attributes['foo'], '');
+ expect($['barBool'].attributes, isNot(contains('foo?')));
+ expect($['barContent'].innerHtml, foo);
+ }
+
+ ready() => _ready.complete();
+}
+
+main() {
+ initPolymer();
+ useHtmlConfiguration();
+
+ setUp(() => Polymer.onReady);
+
+ test('ready called', () => query('x-foo').onTestDone);
+}
« no previous file with comments | « pkg/polymer/test/bind_mdv_test.dart ('k') | pkg/polymer/test/bind_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698