| 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() => initPolymer().run(() { |
| 44 main() { | |
| 45 useHtmlConfiguration(); | 44 useHtmlConfiguration(); |
| 46 | 45 |
| 47 setUp(() => Polymer.onReady); | 46 setUp(() => Polymer.onReady); |
| 48 | 47 |
| 49 // Most tests use @CustomTag, here we test out the impertive register: | 48 // Most tests use @CustomTag, here we test out the impertive register: |
| 50 Polymer.register('x-foo', XFoo); | 49 Polymer.register('x-foo', XFoo); |
| 51 Polymer.register('x-bar', XBar); | 50 Polymer.register('x-bar', XBar); |
| 52 Polymer.register('x-compose', XCompose); | 51 Polymer.register('x-compose', XCompose); |
| 53 | 52 |
| 54 test('property attribute reflection', () { | 53 test('property attribute reflection', () { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 }).then((_) => onAttributeChange(xbar)).then((_) { | 108 }).then((_) => onAttributeChange(xbar)).then((_) { |
| 110 expect(xbar.attributes.containsKey('zim'), false, reason: | 109 expect(xbar.attributes.containsKey('zim'), false, reason: |
| 111 'attribute reflects false valued boolean property as NOT ' | 110 'attribute reflects false valued boolean property as NOT ' |
| 112 'having attribute'); | 111 'having attribute'); |
| 113 xbar.obj = 'hi'; | 112 xbar.obj = 'hi'; |
| 114 }).then((_) => onAttributeChange(xbar)).then((_) { | 113 }).then((_) => onAttributeChange(xbar)).then((_) { |
| 115 expect(xbar.attributes['obj'], 'hi', reason: | 114 expect(xbar.attributes['obj'], 'hi', reason: |
| 116 'reflect property based on current type'); | 115 'reflect property based on current type'); |
| 117 }); | 116 }); |
| 118 }); | 117 }); |
| 119 } | 118 }); |
| OLD | NEW |