OLD | NEW |
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 document_register_basic_test; | 5 library document_register_basic_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 '../utils.dart'; | 9 import '../utils.dart'; |
10 | 10 |
11 class Foo extends HtmlElement { | 11 class Foo extends HtmlElement { |
12 static final tag = 'x-foo'; | 12 static final tag = 'x-foo'; |
13 factory Foo() => new Element.tag(tag); | 13 factory Foo() => new Element.tag(tag); |
| 14 Foo.created() : super.created(); |
14 | 15 |
15 get thisIsACustomClass => true; | 16 get thisIsACustomClass => true; |
16 } | 17 } |
17 | 18 |
18 class Bar extends HtmlElement { | 19 class Bar extends HtmlElement { |
19 static final tag = 'x-bar'; | 20 static final tag = 'x-bar'; |
20 factory Bar() => new Element.tag(tag); | 21 factory Bar() => new Element.tag(tag); |
| 22 Bar.created() : super.created(); |
21 | 23 |
22 get thisIsACustomClass => true; | 24 get thisIsACustomClass => true; |
23 } | 25 } |
24 | 26 |
25 class Baz extends Foo { | 27 class Baz extends Foo { |
26 static final tag = 'x-baz'; | 28 static final tag = 'x-baz'; |
27 factory Baz() => new Element.tag(tag); | 29 factory Baz() => new Element.tag(tag); |
| 30 Baz.created() : super.created(); |
28 | 31 |
29 get thisIsAlsoACustomClass => true; | 32 get thisIsAlsoACustomClass => true; |
30 } | 33 } |
31 | 34 |
32 class BadB { | 35 class BadB { |
33 } | 36 } |
34 | 37 |
35 class BadE implements HtmlElement { | 38 class BadE implements HtmlElement { |
36 static final tag = 'x-tag-e'; | 39 static final tag = 'x-tag-e'; |
37 factory BadE() => new Element.tag(tag); | 40 factory BadE() => new Element.tag(tag); |
| 41 BadE.created() : super.created(); |
38 } | 42 } |
39 | 43 |
40 main() { | 44 main() { |
41 useHtmlConfiguration(); | 45 useHtmlConfiguration(); |
42 | 46 |
43 // Adapted from Blink's fast/dom/custom/document-register-basic test. | 47 // Adapted from Blink's fast/dom/custom/document-register-basic test. |
44 | 48 |
45 setUp(loadPolyfills); | 49 setUp(loadPolyfills); |
46 | 50 |
47 test('Testing document.register() basic behaviors', () { | 51 test('Testing document.register() basic behaviors', () { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 expect(container.firstChild.tagName, "X-BAR"); | 133 expect(container.firstChild.tagName, "X-BAR"); |
130 expect(container.lastChild is Bar, isTrue); | 134 expect(container.lastChild is Bar, isTrue); |
131 expect(container.lastChild.tagName, "X-BAR"); | 135 expect(container.lastChild.tagName, "X-BAR"); |
132 | 136 |
133 // Constructors shouldn't interfere with each other | 137 // Constructors shouldn't interfere with each other |
134 expect((new Foo()).tagName, "X-FOO"); | 138 expect((new Foo()).tagName, "X-FOO"); |
135 expect((new Bar()).tagName, "X-BAR"); | 139 expect((new Bar()).tagName, "X-BAR"); |
136 expect((new Baz()).tagName, "X-BAZ"); | 140 expect((new Baz()).tagName, "X-BAZ"); |
137 }); | 141 }); |
138 } | 142 } |
OLD | NEW |