OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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('mutationobserver_test'); | 5 #library('mutationobserver_test'); |
6 #import('../../pkg/unittest/unittest.dart'); | 6 #import('../../pkg/unittest/unittest.dart'); |
7 #import('../../pkg/unittest/html_config.dart'); | 7 #import('../../pkg/unittest/html_config.dart'); |
8 #import('dart:html'); | 8 #import('dart:html'); |
9 | 9 |
10 /** | 10 /** |
(...skipping 20 matching lines...) Expand all Loading... |
31 expect(nodes.length, count); | 31 expect(nodes.length, count); |
32 expect(nodes, expectation); | 32 expect(nodes, expectation); |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 return expectAsyncUntil2(callback, () => done); | 36 return expectAsyncUntil2(callback, () => done); |
37 } | 37 } |
38 | 38 |
39 test('empty options is syntax error', () { | 39 test('empty options is syntax error', () { |
40 var mutationObserver = new MutationObserver( | 40 var mutationObserver = new MutationObserver( |
41 (mutations, observer) { expect(false, 'Should not be reached'); }); | 41 (mutations, observer) { expect(false, isTrue, |
| 42 reason: 'Should not be reached'); }); |
42 expect(() { mutationObserver.observe(document, {}); }, | 43 expect(() { mutationObserver.observe(document, {}); }, |
43 throws); | 44 throws); |
44 }); | 45 }); |
45 | 46 |
46 test('direct-parallel options-map', () { | 47 test('direct-parallel options-map', () { |
47 var container = new DivElement(); | 48 var container = new DivElement(); |
48 var div1 = new DivElement(); | 49 var div1 = new DivElement(); |
49 var div2 = new DivElement(); | 50 var div2 = new DivElement(); |
50 var mutationObserver = new MutationObserver( | 51 var mutationObserver = new MutationObserver( |
51 mutationCallback(2, orderedEquals([div1, div2]))); | 52 mutationCallback(2, orderedEquals([div1, div2]))); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 var div2 = new DivElement(); | 100 var div2 = new DivElement(); |
100 var mutationObserver = new MutationObserver( | 101 var mutationObserver = new MutationObserver( |
101 mutationCallback(2, orderedEquals([div1, div2]))); | 102 mutationCallback(2, orderedEquals([div1, div2]))); |
102 mutationObserver.observe(container, childList: true, subtree: true); | 103 mutationObserver.observe(container, childList: true, subtree: true); |
103 | 104 |
104 container.nodes.add(div1); | 105 container.nodes.add(div1); |
105 div1.nodes.add(div2); | 106 div1.nodes.add(div2); |
106 }); | 107 }); |
107 }); | 108 }); |
108 } | 109 } |
OLD | NEW |