| 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/platform.dart' as Platform; | |
| 10 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 11 | 10 |
| 12 class XFoo extends PolymerElement { | 11 class XFoo extends PolymerElement { |
| 13 XFoo.created() : super.created(); | 12 XFoo.created() : super.created(); |
| 14 | 13 |
| 15 @observable var foo = ''; | 14 @observable var foo = ''; |
| 16 @observable String baz = ''; | 15 @observable String baz = ''; |
| 17 } | 16 } |
| 18 | 17 |
| 19 class XBar extends XFoo { | 18 class XBar extends XFoo { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 30 | 29 |
| 31 @observable bool zim = false; | 30 @observable bool zim = false; |
| 32 } | 31 } |
| 33 | 32 |
| 34 Future onAttributeChange(Element node) { | 33 Future onAttributeChange(Element node) { |
| 35 var completer = new Completer(); | 34 var completer = new Completer(); |
| 36 new MutationObserver((records, observer) { | 35 new MutationObserver((records, observer) { |
| 37 observer.disconnect(); | 36 observer.disconnect(); |
| 38 completer.complete(); | 37 completer.complete(); |
| 39 })..observe(node, attributes: true); | 38 })..observe(node, attributes: true); |
| 40 Platform.flush(); | 39 scheduleMicrotask(Observable.dirtyCheck); |
| 41 return completer.future; | 40 return completer.future; |
| 42 } | 41 } |
| 43 | 42 |
| 44 main() { | 43 main() { |
| 45 initPolymer(); | 44 initPolymer(); |
| 46 useHtmlConfiguration(); | 45 useHtmlConfiguration(); |
| 47 | 46 |
| 48 setUp(() => Polymer.onReady); | 47 setUp(() => Polymer.onReady); |
| 49 | 48 |
| 50 // Most tests use @CustomTag, here we test out the impertive register: | 49 // Most tests use @CustomTag, here we test out the impertive register: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 expect(xbar.attributes.containsKey('zim'), false, reason: | 110 expect(xbar.attributes.containsKey('zim'), false, reason: |
| 112 'attribute reflects false valued boolean property as NOT ' | 111 'attribute reflects false valued boolean property as NOT ' |
| 113 'having attribute'); | 112 'having attribute'); |
| 114 xbar.obj = 'hi'; | 113 xbar.obj = 'hi'; |
| 115 }).then((_) => onAttributeChange(xbar)).then((_) { | 114 }).then((_) => onAttributeChange(xbar)).then((_) { |
| 116 expect(xbar.attributes['obj'], 'hi', reason: | 115 expect(xbar.attributes['obj'], 'hi', reason: |
| 117 'reflect property based on current type'); | 116 'reflect property based on current type'); |
| 118 }); | 117 }); |
| 119 }); | 118 }); |
| 120 } | 119 } |
| OLD | NEW |