| 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 | 9 |
| 10 class Foo extends HtmlElement { | 10 class Foo extends HtmlElement { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 document.body.append(container); | 85 document.body.append(container); |
| 86 container.innerHtml = "<x-foo></x-foo>"; | 86 container.innerHtml = "<x-foo></x-foo>"; |
| 87 var parsedFoo = container.firstChild; | 87 var parsedFoo = container.firstChild; |
| 88 | 88 |
| 89 expect(parsedFoo is Foo, isTrue); | 89 expect(parsedFoo is Foo, isTrue); |
| 90 expect(parsedFoo.tagName, "X-FOO"); | 90 expect(parsedFoo.tagName, "X-FOO"); |
| 91 | 91 |
| 92 // Ensuring the wrapper is retained | 92 // Ensuring the wrapper is retained |
| 93 var someProperty = new Expando(); | 93 var someProperty = new Expando(); |
| 94 someProperty[parsedFoo] = "hello"; | 94 someProperty[parsedFoo] = "hello"; |
| 95 // TODO(vsm): Fix this in Dartium. | 95 expect(container.firstChild, parsedFoo); |
| 96 // expect(someProperty[container.firstChild], someProperty[parsedFoo]); | 96 expect(someProperty[container.firstChild], someProperty[parsedFoo]); |
| 97 // expect(container.firstChild, parsedFoo); | |
| 98 | 97 |
| 99 // Having another constructor | 98 // Having another constructor |
| 100 document.register(Bar.tag, Bar); | 99 document.register(Bar.tag, Bar); |
| 101 var createdBar = new Bar(); | 100 var createdBar = new Bar(); |
| 102 expect(createdBar is Bar, isTrue); | 101 expect(createdBar is Bar, isTrue); |
| 103 expect(createdBar is Foo, isFalse); | 102 expect(createdBar is Foo, isFalse); |
| 104 expect(createdBar.tagName, "X-BAR"); | 103 expect(createdBar.tagName, "X-BAR"); |
| 105 | 104 |
| 106 // Having a subclass | 105 // Having a subclass |
| 107 document.register(Baz.tag, Baz); | 106 document.register(Baz.tag, Baz); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 123 expect(container.firstChild.tagName, "X-BAR"); | 122 expect(container.firstChild.tagName, "X-BAR"); |
| 124 expect(container.lastChild is Bar, isTrue); | 123 expect(container.lastChild is Bar, isTrue); |
| 125 expect(container.lastChild.tagName, "X-BAR"); | 124 expect(container.lastChild.tagName, "X-BAR"); |
| 126 | 125 |
| 127 // Constructors shouldn't interfere with each other | 126 // Constructors shouldn't interfere with each other |
| 128 expect((new Foo()).tagName, "X-FOO"); | 127 expect((new Foo()).tagName, "X-FOO"); |
| 129 expect((new Bar()).tagName, "X-BAR"); | 128 expect((new Bar()).tagName, "X-BAR"); |
| 130 expect((new Baz()).tagName, "X-BAZ"); | 129 expect((new Baz()).tagName, "X-BAZ"); |
| 131 }); | 130 }); |
| 132 } | 131 } |
| OLD | NEW |