| 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 constructor_calls_created_synchronously_test; | 5 library constructor_calls_created_synchronously_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 import 'dart:mirrors'; |
| 10 | 11 |
| 11 class A extends HtmlElement { | 12 class A extends HtmlElement { |
| 12 static final tag = 'x-a'; | 13 static final tag = 'x-a'; |
| 13 factory A() => new Element.tag(tag); | 14 factory A() => new Element.tag(tag); |
| 15 A.created() : super.created(); |
| 14 | 16 |
| 15 static int ncallbacks = 0; | 17 static int ncallbacks = 0; |
| 16 | 18 |
| 17 void created() { | 19 void createdCallback() { |
| 18 ncallbacks++; | 20 ncallbacks++; |
| 19 } | 21 } |
| 20 } | 22 } |
| 21 | 23 |
| 22 main() { | 24 main() { |
| 23 useHtmlConfiguration(); | 25 useHtmlConfiguration(); |
| 24 | 26 |
| 25 // Adapted from Blink's | 27 // Adapted from Blink's |
| 26 // fast/dom/custom/constructor-calls-created-synchronously test. | 28 // fast/dom/custom/constructor-calls-created-synchronously test. |
| 27 | 29 |
| 28 setUp(loadPolyfills); | 30 setUp(loadPolyfills); |
| 29 | 31 |
| 30 test('createdCallback', () { | 32 test('createdCallback', () { |
| 31 document.register(A.tag, A); | 33 document.register(A.tag, A); |
| 32 var x = new A(); | 34 var x = new A(); |
| 33 expect(A.ncallbacks, 1); | 35 expect(A.ncallbacks, 1); |
| 34 }); | 36 }); |
| 35 } | 37 } |
| OLD | NEW |