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

Side by Side Diff: tests/html/custom_tags_test.dart

Issue 16374007: 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 | « tests/html/custom_elements_test.dart ('k') | tests/html/element_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_tags_test; 5 library custom_tags_test;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_config.dart'; 7 import '../../pkg/unittest/lib/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'utils.dart';
9 10
10 main() { 11 main() {
11 useHtmlConfiguration(); 12 useHtmlConfiguration();
12 13
13 test('create via custom tag', () { 14 test('create via custom tag', () {
14 var element = new Element.tag('x-basic1')..id = 'basic1'; 15 var element = new Element.tag('x-basic1')..id = 'basic1';
15 document.body.nodes.add(element); 16 document.body.nodes.add(element);
16 17
17 var queryById = query('#basic1'); 18 var queryById = query('#basic1');
18 expect(queryById, equals(element)); 19 expect(queryById, equals(element));
19 20
20 var queryByTag = queryAll('x-basic1'); 21 var queryByTag = queryAll('x-basic1');
21 expect(queryByTag.length, equals(1)); 22 expect(queryByTag.length, equals(1));
22 expect(queryByTag[0], equals(element)); 23 expect(queryByTag[0], equals(element));
23 }); 24 });
24 25
25 test('custom inner html', () { 26 test('custom inner html', () {
26 var element = new DivElement(); 27 var element = new DivElement();
27 element.innerHtml = "<x-basic2 id='basic2'></x-basic2>"; 28 element.setInnerHtml("<x-basic2 id='basic2'></x-basic2>",
29 treeSanitizer: new NullTreeSanitizer());
28 document.body.nodes.add(element); 30 document.body.nodes.add(element);
29 31
30 var queryById = query('#basic2'); 32 var queryById = query('#basic2');
31 expect(queryById is Element, isTrue); 33 expect(queryById is Element, isTrue);
32 34
33 var queryByTag = queryAll('x-basic2'); 35 var queryByTag = queryAll('x-basic2');
34 expect(queryByTag.length, equals(1)); 36 expect(queryByTag.length, equals(1));
35 expect(queryByTag[0], equals(queryById)); 37 expect(queryByTag[0], equals(queryById));
36 }); 38 });
37 39
38 test('type extension inner html', () { 40 test('type extension inner html', () {
39 var element = new DivElement(); 41 var element = new DivElement();
40 element.innerHtml = "<div is='x-basic3' id='basic3'></div>"; 42 element.setInnerHtml("<div is='x-basic3' id='basic3'></div>",
43 treeSanitizer: new NullTreeSanitizer());
41 document.body.nodes.add(element); 44 document.body.nodes.add(element);
42 45
43 var queryById = query('#basic3'); 46 var queryById = query('#basic3');
44 expect(queryById is DivElement, isTrue); 47 expect(queryById is DivElement, isTrue);
45 }); 48 });
46 } 49 }
OLDNEW
« no previous file with comments | « tests/html/custom_elements_test.dart ('k') | tests/html/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698