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

Side by Side Diff: pkg/custom_element/test/custom_element_test.dart

Issue 23523002: Revert "First rev of Safe DOM" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | pkg/mdv/test/custom_element_bindings_test.dart » ('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 custom_element.test.custom_element_test; 5 library custom_element.test.custom_element_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:custom_element/custom_element.dart'; 9 import 'package:custom_element/custom_element.dart';
10 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 12
13 main() { 13 main() {
14 useHtmlConfiguration(); 14 useHtmlConfiguration();
15 15
16 // Load the MutationObserver polyfill. 16 // Load the MutationObserver polyfill.
17 HttpRequest.getString('/root_dart/pkg/mutation_observer/lib/' 17 HttpRequest.getString('/root_dart/pkg/mutation_observer/lib/'
18 'mutation_observer.js').then((code) { 18 'mutation_observer.js').then((code) {
19 document.head.children.add(new ScriptElement()..text = code); 19 document.head.children.add(new ScriptElement()..text = code);
20 20
21 customElementTests(); 21 customElementTests();
22 }); 22 });
23 } 23 }
24 24
25 customElementTests() { 25 customElementTests() {
26 test('register creates the element and calls lifecycle methods', () { 26 test('register creates the element and calls lifecycle methods', () {
27 // Add element to the page. 27 // Add element to the page.
28 var element = new Element.html('<fancy-button>foo bar</fancy-button>', 28 var element = new Element.html('<fancy-button>foo bar</fancy-button>');
29 treeSanitizer: new NullTreeSanitizer());
30 document.body.nodes.add(element); 29 document.body.nodes.add(element);
31 30
32 var xtag = null; 31 var xtag = null;
33 registerCustomElement('fancy-button', () => xtag = new FancyButton()); 32 registerCustomElement('fancy-button', () => xtag = new FancyButton());
34 expect(xtag, isNotNull, reason: 'FancyButton was created'); 33 expect(xtag, isNotNull, reason: 'FancyButton was created');
35 expect(element.xtag, xtag, reason: 'xtag pointer should be set'); 34 expect(element.xtag, xtag, reason: 'xtag pointer should be set');
36 expect(xtag.host, element, reason: 'host pointer should be set'); 35 expect(xtag.host, element, reason: 'host pointer should be set');
37 expect(xtag.lifecycle, ['created']); 36 expect(xtag.lifecycle, ['created']);
38 return new Future(() { 37 return new Future(() {
39 expect(xtag.lifecycle, ['created', 'inserted']); 38 expect(xtag.lifecycle, ['created', 'inserted']);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 84 }
86 inserted() { 85 inserted() {
87 super.inserted(); 86 super.inserted();
88 lifecycle.add('inserted'); 87 lifecycle.add('inserted');
89 } 88 }
90 removed() { 89 removed() {
91 super.removed(); 90 super.removed();
92 lifecycle.add('removed'); 91 lifecycle.add('removed');
93 } 92 }
94 } 93 }
95
96 /**
97 * Sanitizer which does nothing.
98 */
99 class NullTreeSanitizer implements NodeTreeSanitizer {
100 void sanitizeTree(Node node) {}
101 }
OLDNEW
« no previous file with comments | « no previous file | pkg/mdv/test/custom_element_bindings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698