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 158083002: introduce web_components pkg for consolidated polyfills (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 13 matching lines...) Expand all
24 24
25 void leftView() { 25 void leftView() {
26 invocations.add('left'); 26 invocations.add('left');
27 } 27 }
28 28
29 void attributeChanged(String name, String oldValue, String newValue) { 29 void attributeChanged(String name, String oldValue, String newValue) {
30 invocations.add('attribute changed'); 30 invocations.add('attribute changed');
31 } 31 }
32 } 32 }
33 33
34 // Pump custom events polyfill events.
35 void customElementsTakeRecords() {
36 if (js.context.hasProperty('CustomElements')) {
37 js.context['CustomElements'].callMethod('takeRecords');
38 }
39 }
40
41 main() { 34 main() {
42 useHtmlIndividualConfiguration(); 35 useHtmlIndividualConfiguration();
43 36
44 // Adapted from Blink's 37 // Adapted from Blink's
45 // fast/dom/custom/entered-left-document.html test. 38 // fast/dom/custom/entered-left-document.html test.
46 39
47 var docA = document; 40 var docA = document;
48 var docB = document.implementation.createHtmlDocument(''); 41 var docB = document.implementation.createHtmlDocument('');
49 42
50 var nullSanitizer = new NullTreeSanitizer(); 43 var nullSanitizer = new NullTreeSanitizer();
51 44
52 var registeredTypes = false; 45 var registeredTypes = false;
53 setUp(() { 46 setUp(() => customElementsReady.then((_) {
54 return loadPolyfills().then((_) { 47 if (registeredTypes) return;
55 if (registeredTypes) { 48 registeredTypes = true;
56 return; 49 document.register('x-a', Foo);
57 } 50 }));
58 registeredTypes = true;
59 document.register('x-a', Foo);
60 });
61 });
62 51
63 group('standard_events', () { 52 group('standard_events', () {
64 var a; 53 var a;
65 setUp(() { 54 setUp(() {
66 invocations = []; 55 invocations = [];
67 }); 56 });
68 57
69 test('Created', () { 58 test('Created', () {
70 a = new Element.tag('x-a'); 59 a = new Element.tag('x-a');
71 expect(invocations, ['created']); 60 expect(invocations, ['created']);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 upgradeCustomElements(div); 224 upgradeCustomElements(div);
236 invocations = []; 225 invocations = [];
237 document.body.append(div); 226 document.body.append(div);
238 customElementsTakeRecords(); 227 customElementsTakeRecords();
239 expect(invocations, ['entered'], 228 expect(invocations, ['entered'],
240 reason: 'the entered callback should be invoked when inserted into a ' 229 reason: 'the entered callback should be invoked when inserted into a '
241 'document with a view as part of a subtree'); 230 'document with a view as part of a subtree');
242 }); 231 });
243 }); 232 });
244 } 233 }
OLDNEW
« no previous file with comments | « tests/html/custom/document_register_type_extensions_test.html ('k') | tests/html/custom/entered_left_view_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698