| 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 created_callback_test; | 5 library created_callback_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 'dart:js' as js; | 9 import 'dart:js' as js; |
| 10 import '../utils.dart'; | 10 import '../utils.dart'; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 test('cannot register created with params', () { | 150 test('cannot register created with params', () { |
| 151 expect(() { | 151 expect(() { |
| 152 document.register('x-created-with-params', CreatedWithParametersElement); | 152 document.register('x-created-with-params', CreatedWithParametersElement); |
| 153 }, throws); | 153 }, throws); |
| 154 }); | 154 }); |
| 155 | 155 |
| 156 test('created cannot be called from nested constructor', | 156 test('created cannot be called from nested constructor', |
| 157 NestedCreatedConstructorElement.test); | 157 NestedCreatedConstructorElement.test); |
| 158 | 158 |
| 159 | |
| 160 // TODO(vsm): Port additional test from upstream here: | 159 // TODO(vsm): Port additional test from upstream here: |
| 161 // http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/crea
ted-callback.html?r1=156141&r2=156185 | 160 // http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/crea
ted-callback.html?r1=156141&r2=156185 |
| 162 } | 161 } |
| 163 | 162 |
| 164 | |
| 165 class NestedElement extends HtmlElement { | 163 class NestedElement extends HtmlElement { |
| 166 static final tag = 'x-nested'; | 164 static final tag = 'x-nested'; |
| 167 | 165 |
| 168 final Element b = new B(); | 166 final Element b = new B(); |
| 169 | 167 |
| 170 factory NestedElement() => new Element.tag(tag); | 168 factory NestedElement() => new Element.tag(tag); |
| 171 NestedElement.created() : super.created(); | 169 NestedElement.created() : super.created(); |
| 172 | 170 |
| 173 static void register() { | 171 static void register() { |
| 174 document.register(tag, NestedElement); | 172 document.register(tag, NestedElement); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } catch(e) { | 288 } catch(e) { |
| 291 rethrow; | 289 rethrow; |
| 292 } finally { | 290 } finally { |
| 293 js.context['testExpectsGlobalError'] = false; | 291 js.context['testExpectsGlobalError'] = false; |
| 294 } | 292 } |
| 295 var errors = js.context['testSuppressedGlobalErrors']; | 293 var errors = js.context['testSuppressedGlobalErrors']; |
| 296 expect(errors['length'], 1); | 294 expect(errors['length'], 1); |
| 297 // Clear out the errors; | 295 // Clear out the errors; |
| 298 js.context['testSuppressedGlobalErrors']['length'] = 0; | 296 js.context['testSuppressedGlobalErrors']['length'] = 0; |
| 299 } | 297 } |
| OLD | NEW |