| 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 import 'dart:mirrors'; |
| 11 | 11 |
| 12 class A extends HtmlElement { | 12 class A extends HtmlElement { |
| 13 static final tag = 'x-a'; | 13 static final tag = 'x-a'; |
| 14 factory A() => new Element.tag(tag); | 14 factory A() => new Element.tag(tag); |
| 15 A.created() : super.created(); | 15 A.created() : super.created() { |
| 16 ncallbacks++; |
| 17 } |
| 16 | 18 |
| 17 static int ncallbacks = 0; | 19 static int ncallbacks = 0; |
| 18 | |
| 19 void createdCallback() { | |
| 20 ncallbacks++; | |
| 21 } | |
| 22 } | 20 } |
| 23 | 21 |
| 24 main() { | 22 main() { |
| 25 useHtmlConfiguration(); | 23 useHtmlConfiguration(); |
| 26 | 24 |
| 27 // Adapted from Blink's | 25 // Adapted from Blink's |
| 28 // fast/dom/custom/constructor-calls-created-synchronously test. | 26 // fast/dom/custom/constructor-calls-created-synchronously test. |
| 29 | 27 |
| 30 var registered = false; | 28 var registered = false; |
| 31 setUp(() { | 29 setUp(() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 45 test('clone node', () { | 43 test('clone node', () { |
| 46 A.ncallbacks = 0; | 44 A.ncallbacks = 0; |
| 47 | 45 |
| 48 var a = new A(); | 46 var a = new A(); |
| 49 expect(A.ncallbacks, 1); | 47 expect(A.ncallbacks, 1); |
| 50 var b = a.clone(false); | 48 var b = a.clone(false); |
| 51 expect(A.ncallbacks, 2); | 49 expect(A.ncallbacks, 2); |
| 52 expect(b is A, isTrue); | 50 expect(b is A, isTrue); |
| 53 }); | 51 }); |
| 54 } | 52 } |
| OLD | NEW |