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/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 | 9 |
10 /** | 10 /** |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 test('direct-parallel options-named', () { | 61 test('direct-parallel options-named', () { |
62 expect(() { | 62 expect(() { |
63 var container = new DivElement(); | 63 var container = new DivElement(); |
64 var div1 = new DivElement(); | 64 var div1 = new DivElement(); |
65 var div2 = new DivElement(); | 65 var div2 = new DivElement(); |
66 var mutationObserver = new MutationObserver( | 66 var mutationObserver = new MutationObserver( |
67 mutationCallback(2, orderedEquals([div1, div2]))); | 67 mutationCallback(2, orderedEquals([div1, div2]))); |
68 mutationObserver.observe(container, childList: true); | 68 mutationObserver.observe(container, childList: true); |
69 | 69 |
70 container.nodes.add(div1); | 70 container.append(div1); |
71 container.nodes.add(div2); | 71 container.append(div2); |
72 }, expectation); | 72 }, expectation); |
73 }); | 73 }); |
74 | 74 |
75 test('direct-nested options-named', () { | 75 test('direct-nested options-named', () { |
76 expect(() { | 76 expect(() { |
77 var container = new DivElement(); | 77 var container = new DivElement(); |
78 var div1 = new DivElement(); | 78 var div1 = new DivElement(); |
79 var div2 = new DivElement(); | 79 var div2 = new DivElement(); |
80 var mutationObserver = | 80 var mutationObserver = |
81 new MutationObserver(mutationCallback(1, orderedEquals([div1]))); | 81 new MutationObserver(mutationCallback(1, orderedEquals([div1]))); |
82 mutationObserver.observe(container, childList: true); | 82 mutationObserver.observe(container, childList: true); |
83 | 83 |
84 container.nodes.add(div1); | 84 container.append(div1); |
85 div1.nodes.add(div2); | 85 div1.append(div2); |
86 }, expectation); | 86 }, expectation); |
87 }); | 87 }); |
88 | 88 |
89 test('subtree options-named', () { | 89 test('subtree options-named', () { |
90 expect(() { | 90 expect(() { |
91 var container = new DivElement(); | 91 var container = new DivElement(); |
92 var div1 = new DivElement(); | 92 var div1 = new DivElement(); |
93 var div2 = new DivElement(); | 93 var div2 = new DivElement(); |
94 var mutationObserver = new MutationObserver( | 94 var mutationObserver = new MutationObserver( |
95 mutationCallback(2, orderedEquals([div1, div2]))); | 95 mutationCallback(2, orderedEquals([div1, div2]))); |
96 mutationObserver.observe(container, childList: true, subtree: true); | 96 mutationObserver.observe(container, childList: true, subtree: true); |
97 | 97 |
98 container.nodes.add(div1); | 98 container.append(div1); |
99 div1.nodes.add(div2); | 99 div1.append(div2); |
100 }, expectation); | 100 }, expectation); |
101 }); | 101 }); |
102 | 102 |
103 test('mutation event', () { | 103 test('mutation event', () { |
104 // Bug 8076 that not all optional params are optional in Dartium. | 104 // Bug 8076 that not all optional params are optional in Dartium. |
105 var event = new MutationEvent('something', prevValue: 'prev', | 105 var event = new MutationEvent('something', prevValue: 'prev', |
106 newValue: 'new', attrName: 'attr'); | 106 newValue: 'new', attrName: 'attr'); |
107 expect(event is MutationEvent, isTrue); | 107 expect(event is MutationEvent, isTrue); |
108 expect(event.prevValue, 'prev'); | 108 expect(event.prevValue, 'prev'); |
109 expect(event.newValue, 'new'); | 109 expect(event.newValue, 'new'); |
110 expect(event.attrName, 'attr'); | 110 expect(event.attrName, 'attr'); |
111 }); | 111 }); |
112 }); | 112 }); |
113 } | 113 } |
OLD | NEW |