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

Side by Side Diff: test/custom_element_test.dart

Issue 1026153002: add initWebComponents (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: code review updates Created 5 years, 9 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 | « test/custom_element_proxy_test.dart ('k') | test/deps/a.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library web_components.test.custom_element_test; 4 library web_components.test.custom_element_test;
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:html'; 7 import 'dart:html';
8 import 'package:initialize/initialize.dart' as init;
9 import 'package:unittest/html_config.dart'; 8 import 'package:unittest/html_config.dart';
10 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
11 import 'package:web_components/web_components.dart'; 10 import 'package:web_components/web_components.dart';
12 11
13 @CustomElement('basic-element') 12 @CustomElement('basic-element')
14 class BasicElement extends HtmlElement { 13 class BasicElement extends HtmlElement {
15 BasicElement.created() : super.created(); 14 BasicElement.created() : super.created();
16 15
17 factory BasicElement() => document.createElement('basic-element'); 16 factory BasicElement() => document.createElement('basic-element');
18 } 17 }
19 18
20 @CustomElement('child-element') 19 @CustomElement('child-element')
21 class ChildElement extends BasicElement { 20 class ChildElement extends BasicElement {
22 ChildElement.created() : super.created(); 21 ChildElement.created() : super.created();
23 22
24 factory ChildElement() => document.createElement('child-element'); 23 factory ChildElement() => document.createElement('child-element');
25 } 24 }
26 25
27 @CustomElement('extended-element', extendsTag: 'input') 26 @CustomElement('extended-element', extendsTag: 'input')
28 class ExtendedElement extends InputElement { 27 class ExtendedElement extends InputElement {
29 ExtendedElement.created() : super.created(); 28 ExtendedElement.created() : super.created();
30 29
31 factory ExtendedElement() => 30 factory ExtendedElement() =>
32 document.createElement('input', 'extended-element'); 31 document.createElement('input', 'extended-element');
33 } 32 }
34 33
35 main() { 34 main() {
36 useHtmlConfiguration(); 35 useHtmlConfiguration();
37 init.run().then((_) { 36 initWebComponents().then((_) {
38 var container = querySelector('#container') as DivElement; 37 var container = querySelector('#container') as DivElement;
39 38
40 setUp(() { 39 setUp(() {
41 return new Future(() {}); 40 return new Future(() {});
42 }); 41 });
43 42
44 tearDown(() { 43 tearDown(() {
45 container.children.clear(); 44 container.children.clear();
46 }); 45 });
47 46
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return new Future(() {}).then((_) { 83 return new Future(() {}).then((_) {
85 var elements = container.querySelectorAll('input'); 84 var elements = container.querySelectorAll('input');
86 expect(elements.length, 2); 85 expect(elements.length, 2);
87 for (var element in elements) { 86 for (var element in elements) {
88 expect(element is ExtendedElement, isTrue); 87 expect(element is ExtendedElement, isTrue);
89 } 88 }
90 }); 89 });
91 }); 90 });
92 }); 91 });
93 } 92 }
OLDNEW
« no previous file with comments | « test/custom_element_proxy_test.dart ('k') | test/deps/a.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698