| 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 factory CustomType() => null; | 21 factory CustomType() => null; |
| 22 CustomType.created(): super.created(); |
| 23 |
| 22 bool createdCalled; // = false; | 24 bool createdCalled; // = false; |
| 23 void created() { | 25 void createdCallback() { |
| 24 createdCalled = true; | 26 createdCalled = true; |
| 25 customCreatedCount++; | 27 customCreatedCount++; |
| 26 } | 28 } |
| 27 | 29 |
| 28 void invokeMixinMethod() { | 30 void invokeMixinMethod() { |
| 29 mixinMethod(); | 31 mixinMethod(); |
| 30 } | 32 } |
| 31 } | 33 } |
| 32 | 34 |
| 33 int customCreatedCount = 0; | 35 int customCreatedCount = 0; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 test('can invoke mixin methods', () { | 192 test('can invoke mixin methods', () { |
| 191 var tag = nextTag; | 193 var tag = nextTag; |
| 192 document.register(tag, CustomType); | 194 document.register(tag, CustomType); |
| 193 | 195 |
| 194 var element = new Element.tag(tag); | 196 var element = new Element.tag(tag); |
| 195 element.invokeMixinMethod(); | 197 element.invokeMixinMethod(); |
| 196 expect(element.mixinMethodCalled, isTrue); | 198 expect(element.mixinMethodCalled, isTrue); |
| 197 }); | 199 }); |
| 198 }); | 200 }); |
| 199 } | 201 } |
| OLD | NEW |