| 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'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 var b = a.clone(false); | 48 var b = a.clone(false); |
| 49 expect(A.ncallbacks, 2); | 49 expect(A.ncallbacks, 2); |
| 50 expect(b is A, isTrue); | 50 expect(b is A, isTrue); |
| 51 }); | 51 }); |
| 52 | 52 |
| 53 test("can extend elements that don't have special prototypes", () { | 53 test("can extend elements that don't have special prototypes", () { |
| 54 document.registerElement('fancy-section', FancySection, | 54 document.registerElement('fancy-section', FancySection, |
| 55 extendsTag: 'section'); | 55 extendsTag: 'section'); |
| 56 var fancy = document.createElement('section', 'fancy-section'); | 56 var fancy = document.createElement('section', 'fancy-section'); |
| 57 expect(fancy is FancySection, true, reason: 'fancy-section was registered'); | 57 expect(fancy is FancySection, true, reason: 'fancy-section was registered'); |
| 58 expect(fancy.wasCreated, true, reason: 'FancySection ctor was called'); | 58 expect((fancy as FancySection).wasCreated, true, reason: 'FancySection ctor
was called'); |
| 59 }); | 59 }); |
| 60 } | 60 } |
| 61 | 61 |
| 62 class FancySection extends HtmlElement { | 62 class FancySection extends HtmlElement { |
| 63 bool wasCreated = false; | 63 bool wasCreated = false; |
| 64 FancySection.created() : super.created() { | 64 FancySection.created() : super.created() { |
| 65 wasCreated = true; | 65 wasCreated = true; |
| 66 } | 66 } |
| 67 } | 67 } |
| OLD | NEW |