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

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

Issue 1154423009: Make it easier and more efficient to use trusted HTML text (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Formatting Created 5 years, 6 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 created_callback_test; 5 library created_callback_test;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 7 import 'package:unittest/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:js' as js; 9 import 'dart:js' as js;
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 }); 79 });
80 80
81 test('unresolved and created callback timing', () { 81 test('unresolved and created callback timing', () {
82 var div = new DivElement(); 82 var div = new DivElement();
83 C.div = div; 83 C.div = div;
84 div.setInnerHtml(""" 84 div.setInnerHtml("""
85 <x-c id="t"></x-c> 85 <x-c id="t"></x-c>
86 <x-b id="u"></x-b> 86 <x-b id="u"></x-b>
87 <x-c id="v"></x-c> 87 <x-c id="v"></x-c>
88 <x-b id="w"></x-b> 88 <x-b id="w"></x-b>
89 """, treeSanitizer: new NullTreeSanitizer()); 89 """, treeSanitizer: NodeTreeSanitizer.trusted);
90 90
91 upgradeCustomElements(div); 91 upgradeCustomElements(div);
92 92
93 expect(C.createdInvocations, 2); 93 expect(C.createdInvocations, 2);
94 expect(div.query('#w') is B, isTrue); 94 expect(div.query('#w') is B, isTrue);
95 }); 95 });
96 96
97 test('nesting of constructors', NestedElement.test); 97 test('nesting of constructors', NestedElement.test);
98 98
99 test('access while upgrading gets unupgraded element', 99 test('access while upgrading gets unupgraded element',
(...skipping 29 matching lines...) Expand all
129 expect(ErrorConstructorElement.callCount, 1); 129 expect(ErrorConstructorElement.callCount, 1);
130 }); 130 });
131 131
132 test('throw on innerHtml does not upgrade', () { 132 test('throw on innerHtml does not upgrade', () {
133 ErrorConstructorElement.callCount = 0; 133 ErrorConstructorElement.callCount = 0;
134 134
135 var dummy = new DivElement(); 135 var dummy = new DivElement();
136 var tag = ErrorConstructorElement.tag; 136 var tag = ErrorConstructorElement.tag;
137 expectGlobalError(() { 137 expectGlobalError(() {
138 dummy.setInnerHtml('<$tag></$tag>', 138 dummy.setInnerHtml('<$tag></$tag>',
139 treeSanitizer: new NullTreeSanitizer()); 139 treeSanitizer: NodeTreeSanitizer.trusted);
140 }); 140 });
141 141
142 expect(ErrorConstructorElement.callCount, 1); 142 expect(ErrorConstructorElement.callCount, 1);
143 143
144 var e = dummy.firstChild; 144 var e = dummy.firstChild;
145 // Accessing should not re-run the constructor. 145 // Accessing should not re-run the constructor.
146 expect(ErrorConstructorElement.callCount, 1); 146 expect(ErrorConstructorElement.callCount, 1);
147 expect(e is HtmlElement, isTrue); 147 expect(e is HtmlElement, isTrue);
148 expect(e is ErrorConstructorElement, isFalse); 148 expect(e is ErrorConstructorElement, isFalse);
149 }); 149 });
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } catch(e) { 292 } catch(e) {
293 rethrow; 293 rethrow;
294 } finally { 294 } finally {
295 js.context['testExpectsGlobalError'] = false; 295 js.context['testExpectsGlobalError'] = false;
296 } 296 }
297 var errors = js.context['testSuppressedGlobalErrors']; 297 var errors = js.context['testSuppressedGlobalErrors'];
298 expect(errors['length'], 1); 298 expect(errors['length'], 1);
299 // Clear out the errors; 299 // Clear out the errors;
300 js.context['testSuppressedGlobalErrors']['length'] = 0; 300 js.context['testSuppressedGlobalErrors']['length'] = 0;
301 } 301 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698