Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: tests/html/custom/entered_left_view_test.dart

Issue 31993005: Remove Platform.upgrateCustomElements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 entered_left_view_test; 5 library entered_left_view_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:js' as js; 9 import 'dart:js' as js;
10 import 'package:unittest/html_individual_config.dart'; 10 import 'package:unittest/html_individual_config.dart';
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 test('Left document with a view', () { 143 test('Left document with a view', () {
144 a.remove(); 144 a.remove();
145 customElementsTakeRecords(); 145 customElementsTakeRecords();
146 expect(invocations, ['left'], 146 expect(invocations, ['left'],
147 reason: 'left callback should be invoked when leaving a document ' 147 reason: 'left callback should be invoked when leaving a document '
148 'with a view'); 148 'with a view');
149 }); 149 });
150 150
151 test('Created in a document without a view', () { 151 test('Created in a document without a view', () {
152 docB.body.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer); 152 docB.body.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer);
153 Platform.upgradeCustomElements(docB.body); 153 customElementsTakeRecords();
154 154
155 expect(invocations, ['created'], 155 expect(invocations, ['created'],
156 reason: 'only created callback should be invoked when parsing a ' 156 reason: 'only created callback should be invoked when parsing a '
157 'custom element in a document without a view'); 157 'custom element in a document without a view');
158 }); 158 });
159 }); 159 });
160 160
161 group('shadow_dom', () { 161 group('shadow_dom', () {
162 var div; 162 var div;
163 var s; 163 var s;
164 setUp(() { 164 setUp(() {
165 invocations = []; 165 invocations = [];
166 div = new DivElement(); 166 div = new DivElement();
167 s = div.createShadowRoot(); 167 s = div.createShadowRoot();
168 }); 168 });
169 169
170 tearDown(() { 170 tearDown(() {
171 customElementsTakeRecords(); 171 customElementsTakeRecords();
172 }); 172 });
173 173
174 test('Created in Shadow DOM that is not in a document', () { 174 test('Created in Shadow DOM that is not in a document', () {
175 s.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer); 175 s.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer);
176 Platform.upgradeCustomElements(s); 176 customElementsTakeRecords();
177 177
178 expect(invocations, ['created'], 178 expect(invocations, ['created'],
179 reason: 'the entered callback should not be invoked when entering a ' 179 reason: 'the entered callback should not be invoked when entering a '
180 'Shadow DOM subtree not in the document'); 180 'Shadow DOM subtree not in the document');
181 }); 181 });
182 182
183 test('Leaves Shadow DOM that is not in a document', () { 183 test('Leaves Shadow DOM that is not in a document', () {
184 s.innerHtml = ''; 184 s.innerHtml = '';
185 expect(invocations, [], 185 expect(invocations, [],
186 reason: 'the left callback should not be invoked when leaving a ' 186 reason: 'the left callback should not be invoked when leaving a '
187 'Shadow DOM subtree not in the document'); 187 'Shadow DOM subtree not in the document');
188 }); 188 });
189 189
190 test('Enters a document with a view as a constituent of Shadow DOM', () { 190 test('Enters a document with a view as a constituent of Shadow DOM', () {
191 s.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer); 191 s.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer);
192 Platform.upgradeCustomElements(s); 192 customElementsTakeRecords();
193 193
194 document.body.append(div); 194 document.body.append(div);
195 customElementsTakeRecords(); 195 customElementsTakeRecords();
196 expect(invocations, ['created', 'entered'], 196 expect(invocations, ['created', 'entered'],
197 reason: 'the entered callback should be invoked when inserted into ' 197 reason: 'the entered callback should be invoked when inserted into '
198 'a document with a view as part of Shadow DOM'); 198 'a document with a view as part of Shadow DOM');
199 199
200 div.remove(); 200 div.remove();
201 customElementsTakeRecords(); 201 customElementsTakeRecords();
202 202
203 expect(invocations, ['created', 'entered', 'left'], 203 expect(invocations, ['created', 'entered', 'left'],
204 reason: 'the left callback should be invoked when removed from a ' 204 reason: 'the left callback should be invoked when removed from a '
205 'document with a view as part of Shadow DOM'); 205 'document with a view as part of Shadow DOM');
206 }); 206 });
207 }); 207 });
208 208
209 209
210 group('disconnected_subtree', () { 210 group('disconnected_subtree', () {
211 var div = new DivElement(); 211 var div = new DivElement();
212 212
213 setUp(() { 213 setUp(() {
214 invocations = []; 214 invocations = [];
215 }); 215 });
216 216
217 test('Enters a disconnected subtree of DOM', () { 217 test('Enters a disconnected subtree of DOM', () {
218 div.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer); 218 div.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer);
219 Platform.upgradeCustomElements(div); 219 customElementsTakeRecords();
220 220
221 expect(invocations, ['created'], 221 expect(invocations, ['created'],
222 reason: 'the entered callback should not be invoked when inserted ' 222 reason: 'the entered callback should not be invoked when inserted '
223 'into a disconnected subtree'); 223 'into a disconnected subtree');
224 }); 224 });
225 225
226 test('Leaves a disconnected subtree of DOM', () { 226 test('Leaves a disconnected subtree of DOM', () {
227 div.innerHtml = ''; 227 div.innerHtml = '';
228 expect(invocations, [], 228 expect(invocations, [],
229 reason: 'the left callback should not be invoked when removed from a ' 229 reason: 'the left callback should not be invoked when removed from a '
230 'disconnected subtree'); 230 'disconnected subtree');
231 }); 231 });
232 232
233 test('Enters a document with a view as a constituent of a subtree', () { 233 test('Enters a document with a view as a constituent of a subtree', () {
234 div.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer); 234 div.setInnerHtml('<x-a></x-a>', treeSanitizer: nullSanitizer);
235 Platform.upgradeCustomElements(div); 235 customElementsTakeRecords();
236 invocations = []; 236 invocations = [];
237 document.body.append(div); 237 document.body.append(div);
238 customElementsTakeRecords(); 238 customElementsTakeRecords();
239 expect(invocations, ['entered'], 239 expect(invocations, ['entered'],
240 reason: 'the entered callback should be invoked when inserted into a ' 240 reason: 'the entered callback should be invoked when inserted into a '
241 'document with a view as part of a subtree'); 241 'document with a view as part of a subtree');
242 }); 242 });
243 }); 243 });
244 } 244 }
OLDNEW
« no previous file with comments | « tests/html/custom/document_register_type_extensions_test.dart ('k') | tests/html/custom_elements_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698