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 22 matching lines...) Expand all Loading... |
33 Future onAttributeChange(Element node) { | 33 Future onAttributeChange(Element node) { |
34 var completer = new Completer(); | 34 var completer = new Completer(); |
35 new MutationObserver((records, observer) { | 35 new MutationObserver((records, observer) { |
36 observer.disconnect(); | 36 observer.disconnect(); |
37 completer.complete(); | 37 completer.complete(); |
38 })..observe(node, attributes: true); | 38 })..observe(node, attributes: true); |
39 scheduleMicrotask(Observable.dirtyCheck); | 39 scheduleMicrotask(Observable.dirtyCheck); |
40 return completer.future; | 40 return completer.future; |
41 } | 41 } |
42 | 42 |
| 43 @initMethod |
43 main() { | 44 main() { |
44 initPolymer(); | |
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', () { |
(...skipping 55 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 |