OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:unittest/html_config.dart'; | 8 import 'package:unittest/html_config.dart'; |
9 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 useHtmlConfiguration(); | 45 useHtmlConfiguration(); |
46 | 46 |
47 setUp(() => Polymer.onReady); | 47 setUp(() => Polymer.onReady); |
48 | 48 |
49 // Most tests use @CustomTag, here we test out the impertive register: | 49 // Most tests use @CustomTag, here we test out the impertive register: |
50 Polymer.register('x-foo', XFoo); | 50 Polymer.register('x-foo', XFoo); |
51 Polymer.register('x-bar', XBar); | 51 Polymer.register('x-bar', XBar); |
52 Polymer.register('x-compose', XCompose); | 52 Polymer.register('x-compose', XCompose); |
53 | 53 |
54 test('property attribute reflection', () { | 54 test('property attribute reflection', () { |
55 var xcompose = query('x-compose'); | 55 var xcompose = querySelector('x-compose'); |
56 var xfoo = query('x-foo'); | 56 var xfoo = querySelector('x-foo'); |
57 var xbar = query('x-bar'); | 57 var xbar = querySelector('x-bar'); |
58 xfoo.foo = 5; | 58 xfoo.foo = 5; |
59 return onAttributeChange(xfoo).then((_) { | 59 return onAttributeChange(xfoo).then((_) { |
60 expect(xcompose.$['bar'].attributes.containsKey('zim'), false, | 60 expect(xcompose.$['bar'].attributes.containsKey('zim'), false, |
61 reason: 'attribute bound to property updates when binding is made'); | 61 reason: 'attribute bound to property updates when binding is made'); |
62 | 62 |
63 expect('${xfoo.foo}', xfoo.attributes['foo'], | 63 expect('${xfoo.foo}', xfoo.attributes['foo'], |
64 reason: 'attribute reflects property as string'); | 64 reason: 'attribute reflects property as string'); |
65 xfoo.attributes['foo'] = '27'; | 65 xfoo.attributes['foo'] = '27'; |
66 // TODO(jmesserly): why is JS leaving this as a String? From the code it | 66 // TODO(jmesserly): why is JS leaving this as a String? From the code it |
67 // looks like it should use the type of 5 and parse it as a number. | 67 // looks like it should use the type of 5 and parse it as a number. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 expect(xbar.attributes.containsKey('zim'), false, reason: | 110 expect(xbar.attributes.containsKey('zim'), false, reason: |
111 'attribute reflects false valued boolean property as NOT ' | 111 'attribute reflects false valued boolean property as NOT ' |
112 'having attribute'); | 112 'having attribute'); |
113 xbar.obj = 'hi'; | 113 xbar.obj = 'hi'; |
114 }).then((_) => onAttributeChange(xbar)).then((_) { | 114 }).then((_) => onAttributeChange(xbar)).then((_) { |
115 expect(xbar.attributes['obj'], 'hi', reason: | 115 expect(xbar.attributes['obj'], 'hi', reason: |
116 'reflect property based on current type'); | 116 'reflect property based on current type'); |
117 }); | 117 }); |
118 }); | 118 }); |
119 } | 119 } |
OLD | NEW |