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

Side by Side Diff: pkg/polymer/test/template_distribute_dynamic_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:async';
6 import 'dart:html';
7 import 'package:polymer/polymer.dart';
8 import 'package:polymer/platform.dart' as Platform;
9 import 'package:unittest/unittest.dart';
10 import 'package:unittest/html_config.dart';
11
12 @CustomTag('x-test')
13 class XTest extends PolymerElement {
14 @observable List list;
15
16 final _enteredView = new Completer();
17 Future onTestDone;
18
19 XTest.created() : super.created() {
20 onTestDone = _enteredView.future.then(_runTest);
21 }
22
23 enteredView() {
24 super.enteredView();
25 _enteredView.complete();
26 }
27
28 _runTest(_) {
29 list = [
30 {'name': 'foo'},
31 {'name': 'bar'}
32 ];
33
34 Platform.flush();
35 Platform.endOfMicrotask(expectAsync0(() {
36 // tickle SD polyfill
37 offsetHeight;
38 var children = this.$['echo'].children;
39 expect(children[0].localName, 'template', reason:
40 'shadowDOM dynamic distribution via template');
41 expect(children[1].text, 'foo', reason:
42 'shadowDOM dynamic distribution via template');
43 expect(children[2].text, 'bar', reason:
44 'shadowDOM dynamic distribution via template');
45
46 // TODO(jmesserly): restore this if we get the JS interop capability.
47 /*
48 if (window.ShadowDOMPolyfill) {
49 var actualChildren = this.$.echo.impl.children;
50 chai.assert.equal(actualChildren.length, 4,
51 'shadowDOMPolyfill distributes expected number of actual children.');
52 }
53 */
54 }));
55 }
56 }
57
58 main() {
59 initPolymer();
60 useHtmlConfiguration();
61
62 setUp(() => Polymer.onReady);
63
64 test('inserted called', () => query('x-test').xtag.onTestDone);
Siggi Cherem (dart-lang) 2013/10/24 00:50:43 remove .xtag
Jennifer Messerly 2013/10/24 00:58:59 Done.
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698