| 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 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:unittest/html_individual_config.dart'; | 8 import 'package:unittest/html_individual_config.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'utils.dart'; | 10 import 'utils.dart'; |
| 11 | 11 |
| 12 class CustomMixin { | 12 class CustomMixin { |
| 13 var mixinMethodCalled; | 13 var mixinMethodCalled; |
| 14 | 14 |
| 15 void mixinMethod() { | 15 void mixinMethod() { |
| 16 mixinMethodCalled = true; | 16 mixinMethodCalled = true; |
| 17 } | 17 } |
| 18 } | 18 } |
| 19 | 19 |
| 20 class CustomType extends HtmlElement with CustomMixin{ | 20 class CustomType extends HtmlElement with CustomMixin{ |
| 21 bool createdCalled = false; |
| 22 |
| 21 factory CustomType() => null; | 23 factory CustomType() => null; |
| 22 CustomType.created(): super.created(); | 24 CustomType.created(): super.created() { |
| 23 | |
| 24 bool createdCalled; // = false; | |
| 25 void createdCallback() { | |
| 26 createdCalled = true; | 25 createdCalled = true; |
| 27 customCreatedCount++; | 26 customCreatedCount++; |
| 28 } | 27 } |
| 29 | 28 |
| 30 void invokeMixinMethod() { | 29 void invokeMixinMethod() { |
| 31 mixinMethod(); | 30 mixinMethod(); |
| 32 } | 31 } |
| 33 } | 32 } |
| 34 | 33 |
| 35 int customCreatedCount = 0; | 34 int customCreatedCount = 0; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 test('can invoke mixin methods', () { | 191 test('can invoke mixin methods', () { |
| 193 var tag = nextTag; | 192 var tag = nextTag; |
| 194 document.register(tag, CustomType); | 193 document.register(tag, CustomType); |
| 195 | 194 |
| 196 var element = new Element.tag(tag); | 195 var element = new Element.tag(tag); |
| 197 element.invokeMixinMethod(); | 196 element.invokeMixinMethod(); |
| 198 expect(element.mixinMethodCalled, isTrue); | 197 expect(element.mixinMethodCalled, isTrue); |
| 199 }); | 198 }); |
| 200 }); | 199 }); |
| 201 } | 200 } |
| OLD | NEW |