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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 class BadE implements HtmlElement { | 38 class BadE implements HtmlElement { |
39 static final tag = 'x-tag-e'; | 39 static final tag = 'x-tag-e'; |
40 factory BadE() => new Element.tag(tag); | 40 factory BadE() => new Element.tag(tag); |
41 } | 41 } |
42 | 42 |
43 main() { | 43 main() { |
44 useHtmlConfiguration(); | 44 useHtmlConfiguration(); |
45 | 45 |
46 // Adapted from Blink's fast/dom/custom/document-register-basic test. | 46 // Adapted from Blink's fast/dom/custom/document-register-basic test. |
47 | 47 |
48 setUp(loadPolyfills); | 48 setUp(() => customElementsReady); |
49 | 49 |
50 test('Testing document.register() basic behaviors', () { | 50 test('Testing document.register() basic behaviors', () { |
51 document.register(Foo.tag, Foo); | 51 document.register(Foo.tag, Foo); |
52 | 52 |
53 // Cannot register an existing dart:html type. | 53 // Cannot register an existing dart:html type. |
54 expect(() => document.register('x-bad-a', HtmlElement), throws); | 54 expect(() => document.register('x-bad-a', HtmlElement), throws); |
55 | 55 |
56 // Invalid user type. Doesn't inherit from HtmlElement. | 56 // Invalid user type. Doesn't inherit from HtmlElement. |
57 expect(() => document.register('x-bad-b', BadB), throws); | 57 expect(() => document.register('x-bad-b', BadB), throws); |
58 | 58 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 expect(container.firstChild.tagName, "X-BAR"); | 132 expect(container.firstChild.tagName, "X-BAR"); |
133 expect(container.lastChild is Bar, isTrue); | 133 expect(container.lastChild is Bar, isTrue); |
134 expect(container.lastChild.tagName, "X-BAR"); | 134 expect(container.lastChild.tagName, "X-BAR"); |
135 | 135 |
136 // Constructors shouldn't interfere with each other | 136 // Constructors shouldn't interfere with each other |
137 expect((new Foo()).tagName, "X-FOO"); | 137 expect((new Foo()).tagName, "X-FOO"); |
138 expect((new Bar()).tagName, "X-BAR"); | 138 expect((new Bar()).tagName, "X-BAR"); |
139 expect((new Baz()).tagName, "X-BAZ"); | 139 expect((new Baz()).tagName, "X-BAZ"); |
140 }); | 140 }); |
141 } | 141 } |
OLD | NEW |