| 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'; | |
| 6 import 'dart:html'; | 5 import 'dart:html'; |
| 7 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 8 import 'package:unittest/html_config.dart'; | 7 import 'package:unittest/html_config.dart'; |
| 9 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 10 | 9 |
| 11 @CustomTag('x-foo') | 10 @CustomTag('x-foo') |
| 12 class XFoo extends PolymerElement { | 11 class XFoo extends PolymerElement { |
| 13 XFoo.created() : super.created(); | 12 XFoo.created() : super.created(); |
| 14 | 13 |
| 15 @published bool boolean = false; | 14 @published bool boolean = false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 46 | 45 |
| 47 @CustomTag('x-obj') | 46 @CustomTag('x-obj') |
| 48 class XObj extends PolymerElement { | 47 class XObj extends PolymerElement { |
| 49 XObj.created() : super.created(); | 48 XObj.created() : super.created(); |
| 50 @observable var values = {}; | 49 @observable var values = {}; |
| 51 } | 50 } |
| 52 | 51 |
| 53 main() { | 52 main() { |
| 54 useHtmlConfiguration(); | 53 useHtmlConfiguration(); |
| 55 | 54 |
| 56 // Delay for custom elements upgrading | 55 setUp(() => Polymer.onReady); |
| 57 setUp(() => new Future.delayed(Duration.ZERO)); | |
| 58 | 56 |
| 59 test('take attributes', () { | 57 test('take attributes', () { |
| 60 queryXTag(x) => document.query(x).xtag; | 58 queryXTag(x) => document.query(x).xtag; |
| 61 | 59 |
| 62 expect(queryXTag("#foo0").boolean, true); | 60 expect(queryXTag("#foo0").boolean, true); |
| 63 expect(queryXTag("#foo1").boolean, false); | 61 expect(queryXTag("#foo1").boolean, false); |
| 64 expect(queryXTag("#foo2").boolean, true); | 62 expect(queryXTag("#foo2").boolean, true); |
| 65 expect(queryXTag("#foo3").boolean, false); | 63 expect(queryXTag("#foo3").boolean, false); |
| 66 // this one is only 'truthy' | 64 // this one is only 'truthy' |
| 67 expect(queryXTag("#foo4").boolean, true); | 65 expect(queryXTag("#foo4").boolean, true); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 expect(queryXTag("#arr1").values, [0, 1, 2]); | 112 expect(queryXTag("#arr1").values, [0, 1, 2]); |
| 115 expect(queryXTag("#arr2").values, [33]); | 113 expect(queryXTag("#arr2").values, [33]); |
| 116 // Object deserialization tests | 114 // Object deserialization tests |
| 117 expect(queryXTag("#obj1").values, { 'name': 'Brandon', | 115 expect(queryXTag("#obj1").values, { 'name': 'Brandon', |
| 118 'nums': [1, 22, 33] }); | 116 'nums': [1, 22, 33] }); |
| 119 expect(queryXTag("#obj2").values, { "color": "Red" }); | 117 expect(queryXTag("#obj2").values, { "color": "Red" }); |
| 120 expect(queryXTag("#obj3").values, { 'movie': 'Buckaroo Banzai', | 118 expect(queryXTag("#obj3").values, { 'movie': 'Buckaroo Banzai', |
| 121 'DOB': '07/31/1978' }); | 119 'DOB': '07/31/1978' }); |
| 122 }); | 120 }); |
| 123 } | 121 } |
| OLD | NEW |