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 attribute_changed_callback_test; | 5 library attribute_changed_callback_test; |
6 | 6 |
| 7 import 'dart:async'; |
7 import 'dart:html'; | 8 import 'dart:html'; |
8 import 'dart:js' as js; | 9 import 'dart:js' as js; |
9 import 'package:unittest/html_individual_config.dart'; | 10 import 'package:unittest/html_individual_config.dart'; |
10 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
11 import '../utils.dart'; | 12 import '../utils.dart'; |
12 | 13 |
13 class A extends HtmlElement { | 14 class A extends HtmlElement { |
14 static final tag = 'x-a'; | 15 static final tag = 'x-a'; |
15 factory A() => new Element.tag(tag); | 16 factory A() => new Element.tag(tag); |
16 A.created() : super.created(); | 17 A.created() : super.created(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 84 |
84 b.attributes.remove('data-v'); | 85 b.attributes.remove('data-v'); |
85 expect(B.invocations, ['data-v: x => null']); | 86 expect(B.invocations, ['data-v: x => null']); |
86 }); | 87 }); |
87 | 88 |
88 test('add, change ID', () { | 89 test('add, change ID', () { |
89 B.invocations = []; | 90 B.invocations = []; |
90 | 91 |
91 var b = new B(); | 92 var b = new B(); |
92 b.id = 'x'; | 93 b.id = 'x'; |
93 expect(B.invocations, ['created', 'id: null => x']); | 94 |
94 | 95 return new Future.delayed(new Duration(milliseconds: 1)) |
95 B.invocations = []; | 96 .then((_) => expect(B.invocations, ['created', 'id: null => x'])) |
96 b.attributes.remove('id'); | 97 .then((_) { |
97 expect(B.invocations, ['id: x => null']); | 98 B.invocations = []; |
| 99 b.attributes.remove('id'); |
| 100 }) |
| 101 .then((_) => new Future.delayed(new Duration(milliseconds: 1))) |
| 102 .then((_) => expect(B.invocations, ['id: x => null'])); |
98 }); | 103 }); |
99 }); | 104 }); |
100 | 105 |
101 group('unsupported_on_polyfill', () { | 106 group('unsupported_on_polyfill', () { |
102 | 107 |
103 // If these tests start passing, don't remove the status suppression. Move | 108 // If these tests start passing, don't remove the status suppression. Move |
104 // the tests to the fullYy_supported group. | 109 // the tests to the fullYy_supported group. |
105 | 110 |
106 test('add, change classes', () { | 111 test('add, change classes', () { |
107 var b = new B(); | 112 var b = new B(); |
108 | 113 |
109 B.invocations = []; | 114 B.invocations = []; |
110 b.classes.toggle('u'); | 115 b.classes.toggle('u'); |
111 expect(B.invocations, ['class: null => u']); | 116 expect(B.invocations, ['class: null => u']); |
112 }); | 117 }); |
113 }); | 118 }); |
114 } | 119 } |
OLD | NEW |