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

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
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..225aab516e011a16f279b23c0e3414c63f43ae01
--- /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);
+ //
Siggi Cherem (dart-lang) 2013/10/24 00:50:43 remove?
Jennifer Messerly 2013/10/24 00:58:59 sure. I think that was from original :)
+ 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').xtag.onTestDone);
Siggi Cherem (dart-lang) 2013/10/24 00:50:43 remove xtag
Jennifer Messerly 2013/10/24 00:58:59 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698