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 custom_elements_test; | 5 library custom_elements_test; |
6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 | 9 |
10 class CustomType extends Element { | 10 class CustomType extends Element { |
11 factory CustomType() => null; | 11 factory CustomType() => null; |
12 | |
13 bool onCreatedCalled = false; | 12 bool onCreatedCalled = false; |
14 void onCreated() { | 13 void onCreated() { |
15 onCreatedCalled = true; | 14 onCreatedCalled = true; |
16 customCreatedCount++; | 15 customCreatedCount++; |
17 } | 16 } |
18 } | 17 } |
19 | 18 |
20 int customCreatedCount = 0; | 19 int customCreatedCount = 0; |
21 | 20 |
22 class NotAnElement {} | 21 class NotAnElement {} |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 int oldCount = customCreatedCount; | 119 int oldCount = customCreatedCount; |
121 | 120 |
122 document.register('x-type9', CustomType); | 121 document.register('x-type9', CustomType); |
123 var element = new DivElement(); | 122 var element = new DivElement(); |
124 element.innerHtml = '<x-type9></x-type9>'; | 123 element.innerHtml = '<x-type9></x-type9>'; |
125 document.body.nodes.add(element); | 124 document.body.nodes.add(element); |
126 expect(customCreatedCount, oldCount + 1); | 125 expect(customCreatedCount, oldCount + 1); |
127 }); | 126 }); |
128 }); | 127 }); |
129 } | 128 } |
OLD | NEW |