| 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 import 'package:smoke/mirrors.dart'; |
| 10 | 11 |
| 11 class XFoo extends PolymerElement { | 12 class XFoo extends PolymerElement { |
| 12 XFoo.created() : super.created(); | 13 XFoo.created() : super.created(); |
| 13 | 14 |
| 14 @observable var foo = ''; | 15 @observable var foo = ''; |
| 15 @observable String baz = ''; | 16 @observable String baz = ''; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class XBar extends XFoo { | 19 class XBar extends XFoo { |
| 19 XBar.created() : super.created(); | 20 XBar.created() : super.created(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 var completer = new Completer(); | 35 var completer = new Completer(); |
| 35 new MutationObserver((records, observer) { | 36 new MutationObserver((records, observer) { |
| 36 observer.disconnect(); | 37 observer.disconnect(); |
| 37 completer.complete(); | 38 completer.complete(); |
| 38 })..observe(node, attributes: true); | 39 })..observe(node, attributes: true); |
| 39 scheduleMicrotask(Observable.dirtyCheck); | 40 scheduleMicrotask(Observable.dirtyCheck); |
| 40 return completer.future; | 41 return completer.future; |
| 41 } | 42 } |
| 42 | 43 |
| 43 main() { | 44 main() { |
| 45 // The static configuration is not complete because of the missing @CustomTag. |
| 46 // TODO(sigmund): add a different annotation for this? (dartbug.com/17790) |
| 47 useMirrors(); |
| 48 |
| 44 initPolymer(); | 49 initPolymer(); |
| 45 useHtmlConfiguration(); | 50 useHtmlConfiguration(); |
| 46 | 51 |
| 47 setUp(() => Polymer.onReady); | 52 setUp(() => Polymer.onReady); |
| 48 | 53 |
| 49 // Most tests use @CustomTag, here we test out the impertive register: | 54 // Most tests use @CustomTag, here we test out the impertive register: |
| 50 Polymer.register('x-foo', XFoo); | 55 Polymer.register('x-foo', XFoo); |
| 51 Polymer.register('x-bar', XBar); | 56 Polymer.register('x-bar', XBar); |
| 52 Polymer.register('x-compose', XCompose); | 57 Polymer.register('x-compose', XCompose); |
| 53 | 58 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 expect(xbar.attributes.containsKey('zim'), false, reason: | 115 expect(xbar.attributes.containsKey('zim'), false, reason: |
| 111 'attribute reflects false valued boolean property as NOT ' | 116 'attribute reflects false valued boolean property as NOT ' |
| 112 'having attribute'); | 117 'having attribute'); |
| 113 xbar.obj = 'hi'; | 118 xbar.obj = 'hi'; |
| 114 }).then((_) => onAttributeChange(xbar)).then((_) { | 119 }).then((_) => onAttributeChange(xbar)).then((_) { |
| 115 expect(xbar.attributes['obj'], 'hi', reason: | 120 expect(xbar.attributes['obj'], 'hi', reason: |
| 116 'reflect property based on current type'); | 121 'reflect property based on current type'); |
| 117 }); | 122 }); |
| 118 }); | 123 }); |
| 119 } | 124 } |
| OLD | NEW |