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

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

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.html
diff --git a/pkg/polymer/test/bind_test.html b/pkg/polymer/test/bind_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..d429ccc70a7ae1cbb31aa685c408f21aba1f2d05
--- /dev/null
+++ b/pkg/polymer/test/bind_test.html
@@ -0,0 +1,66 @@
+<!doctype html>
+<!--
+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.
+-->
+<html>
+ <head>
+ <title>bind simple</title>
+ <script src="packages/polymer/boot.js"></script>
+ <script src="packages/unittest/test_controller.js"></script>
+ </head>
+ <body>
+ <x-foo></x-foo>
+
+ <polymer-element name="x-bar" noscript>
+ <template>
+ x-bar
+ </template>
+ </polymer-element>
+
+ <polymer-element name="x-foo">
+ <template>
+ <div id="foo" foo="{{foo}}"></div>
+ <div id="bool" foo?="{{foo}}"></div>
+ <div id="content">{{foo}}</div>
+ <x-bar id="bar" foo="{{foo}}" ></x-bar>
+ <x-bar id="barBool" foo?="{{foo}}"></x-bar>
+ <x-bar id="barContent">{{foo}}</x-bar>
+ </template>
+ <script type="application/dart">
+ import 'dart:async';
+ import 'package:polymer/polymer.dart';
+ import 'package:unittest/matcher.dart';
+
+ @CustomTag('x-foo')
+ class XFoo extends PolymerElement {
+ @observable var foo = 'foo!';
+ final _ready = new Completer();
+ Future onTestDone;
+
+ 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();
+ }
+ </script>
+ </polymer-element>
+
+ <script type="application/dart" src="bind_test.dart"></script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698