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 library polymer.test.unbind_test; | 5 library polymer.test.unbind_test; |
6 | 6 |
7 import 'dart:async' show Future, scheduleMicrotask; | 7 import 'dart:async' show Future, scheduleMicrotask; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 | 9 |
10 @MirrorsUsed(targets: const [Polymer], override: 'polymer.test.unbind_test') | 10 @MirrorsUsed(targets: const [Polymer], override: 'polymer.test.unbind_test') |
(...skipping 21 matching lines...) Expand all Loading... |
32 fooWasChanged = true; | 32 fooWasChanged = true; |
33 } | 33 } |
34 | 34 |
35 barChanged() { | 35 barChanged() { |
36 validBar = bar; | 36 validBar = bar; |
37 } | 37 } |
38 | 38 |
39 bool get isBarValid => validBar == bar; | 39 bool get isBarValid => validBar == bar; |
40 } | 40 } |
41 | 41 |
42 @initMethod | 42 main() => initPolymer().run(() { |
43 main() { | |
44 useHtmlConfiguration(); | 43 useHtmlConfiguration(); |
45 | 44 |
46 setUp(() => Polymer.onReady); | 45 setUp(() => Polymer.onReady); |
47 | 46 |
48 test('unbind', unbindTests); | 47 test('unbind', unbindTests); |
49 } | 48 }); |
50 | 49 |
51 Future testAsync(List<Function> tests, int delayMs, [List args]) { | 50 Future testAsync(List<Function> tests, int delayMs, [List args]) { |
52 if (tests.length == 0) return new Future.value(); | 51 if (tests.length == 0) return new Future.value(); |
53 // TODO(jmesserly): CustomElements.takeRecords(); | 52 // TODO(jmesserly): CustomElements.takeRecords(); |
54 return new Future.delayed(new Duration(milliseconds: delayMs), () { | 53 return new Future.delayed(new Duration(milliseconds: delayMs), () { |
55 if (args == null) args = []; | 54 if (args == null) args = []; |
56 var lastArgs = Function.apply(tests.removeAt(0), args); | 55 var lastArgs = Function.apply(tests.removeAt(0), args); |
57 return testAsync(tests, delayMs, lastArgs); | 56 return testAsync(tests, delayMs, lastArgs); |
58 }); | 57 }); |
59 } | 58 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 }).then(delay).then((node) { | 105 }).then(delay).then((node) { |
107 expect(_unbound(node), null, reason: | 106 expect(_unbound(node), null, reason: |
108 'element is bound when manually inserted'); | 107 'element is bound when manually inserted'); |
109 node.remove(); | 108 node.remove(); |
110 return node; | 109 return node; |
111 }).then(delay).then((node) { | 110 }).then(delay).then((node) { |
112 expect(_unbound(node), true, reason: | 111 expect(_unbound(node), true, reason: |
113 'element is unbound when manually removed is called'); | 112 'element is unbound when manually removed is called'); |
114 }); | 113 }); |
115 } | 114 } |
OLD | NEW |