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:html'; | 7 import 'dart:html'; |
8 import 'dart:js' as js; | 8 import 'dart:js' as js; |
9 import 'package:unittest/html_individual_config.dart'; | 9 import 'package:unittest/html_individual_config.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 js.context['CustomElements'].callMethod('takeRecords'); | 42 js.context['CustomElements'].callMethod('takeRecords'); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 main() { | 46 main() { |
47 useHtmlIndividualConfiguration(); | 47 useHtmlIndividualConfiguration(); |
48 | 48 |
49 // Adapted from Blink's fast/dom/custom/attribute-changed-callback test. | 49 // Adapted from Blink's fast/dom/custom/attribute-changed-callback test. |
50 | 50 |
51 var registered = false; | 51 var registered = false; |
52 setUp(() { | 52 setUp(() => customElementsReady.then((_) { |
53 return loadPolyfills().then((_) { | 53 if (!registered) { |
54 if (!registered) { | 54 registered = true; |
55 registered = true; | 55 document.register(A.tag, A); |
56 document.register(A.tag, A); | 56 document.register(B.tag, B); |
57 document.register(B.tag, B); | 57 } |
58 } | 58 })); |
59 }); | |
60 }); | |
61 | 59 |
62 group('fully_supported', () { | 60 group('fully_supported', () { |
63 test('transfer attribute changed callback', () { | 61 test('transfer attribute changed callback', () { |
64 var element = new A(); | 62 var element = new A(); |
65 | 63 |
66 element.attributes['a'] = 'b'; | 64 element.attributes['a'] = 'b'; |
67 expect(A.attributeChangedInvocations, 1); | 65 expect(A.attributeChangedInvocations, 1); |
68 }); | 66 }); |
69 | 67 |
70 test('add, change and remove an attribute', () { | 68 test('add, change and remove an attribute', () { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 101 |
104 test('add, change classes', () { | 102 test('add, change classes', () { |
105 var b = new B(); | 103 var b = new B(); |
106 | 104 |
107 B.invocations = []; | 105 B.invocations = []; |
108 b.classes.toggle('u'); | 106 b.classes.toggle('u'); |
109 expect(B.invocations, ['class: null => u']); | 107 expect(B.invocations, ['class: null => u']); |
110 }); | 108 }); |
111 }); | 109 }); |
112 } | 110 } |
OLD | NEW |