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

Side by Side Diff: pkg/polymer/test/bind_properties_test.dart

Issue 420673002: Roll polymer packages to version 0.3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
« no previous file with comments | « pkg/polymer/test/auto_binding_test.dart ('k') | pkg/polymer/test/bind_properties_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:unittest/unittest.dart';
8 import 'package:unittest/html_config.dart';
9 import 'package:polymer/polymer.dart';
10
11 export 'package:polymer/init.dart';
12
13 class XBaz extends PolymerElement {
14 @published
15 int get val => readValue(#val);
16 set val(v) => writeValue(#val, v);
17
18 XBaz.created() : super.created();
19 }
20
21 class XBar extends PolymerElement {
22 @published
23 int get val => readValue(#val);
24 set val(v) => writeValue(#val, v);
25
26 XBar.created() : super.created();
27 }
28
29 class XBat extends PolymerElement {
30 @published
31 int get val => readValue(#val);
32 set val(v) => writeValue(#val, v);
33
34 XBat.created() : super.created();
35 }
36
37 class XFoo extends PolymerElement {
38 @published
39 int get val => readValue(#val);
40 set val(v) => writeValue(#val, v);
41
42 XFoo.created() : super.created();
43 }
44
45 @CustomTag('bind-properties-test')
46 class XTest extends PolymerElement {
47 XTest.created() : super.created();
48
49 @published var obj;
50
51 ready() {
52 obj = toObservable({'path': {'to': {'value': 3}}});
53 readyCalled();
54 }
55 }
56
57 var completer = new Completer();
58 waitForElementReady(_) => completer.future;
59 readyCalled() { completer.complete(null); }
60
61 @initMethod
62 init() {
63 // TODO(sigmund): investigate why are we still seeing failures due to the
64 // order of registrations, then use @CustomTag instead of this.
65 Polymer.register('x-foo', XFoo);
66 Polymer.register('x-bar', XBar);
67 Polymer.register('x-baz', XBaz);
68 Polymer.register('x-bat', XBat);
69
70 useHtmlConfiguration();
71
72 setUp(() => Polymer.onReady.then(waitForElementReady));
73
74 test('bind properties test', () {
75 var e = document.querySelector('bind-properties-test');
76 var foo = e.shadowRoot.querySelector('#foo');
77 var bar = foo.shadowRoot.querySelector('#bar');
78 var bat = foo.shadowRoot.querySelector('#bat');
79 var baz = bar.shadowRoot.querySelector('#baz');
80
81 expect(foo.val, 3);
82 expect(bar.val, 3);
83 expect(bat.val, 3);
84 expect(baz.val, 3);
85
86 foo.val = 4;
87
88 expect(foo.val, 4);
89 expect(bar.val, 4);
90 expect(bat.val, 4);
91 expect(baz.val, 4);
92
93 baz.val = 5;
94
95 expect(foo.val, 5);
96 expect(bar.val, 5);
97 expect(bat.val, 5);
98 expect(baz.val, 5);
99
100 e.obj['path']['to']['value'] = 6;
101
102 expect(foo.val, 6);
103 expect(bar.val, 6);
104 expect(bat.val, 6);
105 expect(baz.val, 6);
106 });
107 }
108
OLDNEW
« no previous file with comments | « pkg/polymer/test/auto_binding_test.dart ('k') | pkg/polymer/test/bind_properties_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698