| 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 '../utils.dart'; | 9 import '../utils.dart'; |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // As per: | 48 // As per: |
| 49 // http://www.w3.org/TR/2013/WD-custom-elements-20130514/#serializing-and-pa
rsing | 49 // http://www.w3.org/TR/2013/WD-custom-elements-20130514/#serializing-and-pa
rsing |
| 50 // creation order is t, u, v, w (postorder). | 50 // creation order is t, u, v, w (postorder). |
| 51 expect(t is C, isTrue); | 51 expect(t is C, isTrue); |
| 52 // Note, this is different from JavaScript where this would be false. | 52 // Note, this is different from JavaScript where this would be false. |
| 53 expect(v is C, isTrue); | 53 expect(v is C, isTrue); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 loadPolyfills() { | |
| 58 if (!document.supportsRegister) { | |
| 59 // Cache blocker is a workaround for: | |
| 60 // https://code.google.com/p/dart/issues/detail?id=11834 | |
| 61 var cacheBlocker = new DateTime.now().millisecondsSinceEpoch; | |
| 62 return HttpRequest.getString('/root_dart/pkg/custom_element/lib/' | |
| 63 'custom-elements.debug.js?cacheBlock=$cacheBlocker').then((code) { | |
| 64 document.head.children.add(new ScriptElement()..text = code); | |
| 65 }); | |
| 66 } | |
| 67 } | |
| 68 | |
| 69 main() { | 57 main() { |
| 70 useHtmlConfiguration(); | 58 useHtmlConfiguration(); |
| 71 | 59 |
| 72 // Adapted from Blink's | 60 // Adapted from Blink's |
| 73 // fast/dom/custom/created-callback test. | 61 // fast/dom/custom/created-callback test. |
| 74 | 62 |
| 75 setUp(loadPolyfills); | 63 setUp(loadPolyfills); |
| 76 | 64 |
| 77 test('transfer created callback', () { | 65 test('transfer created callback', () { |
| 78 document.register(A.tag, A); | 66 document.register(A.tag, A); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 95 | 83 |
| 96 Platform.upgradeCustomElements(div); | 84 Platform.upgradeCustomElements(div); |
| 97 | 85 |
| 98 expect(C.createdInvocations, 2); | 86 expect(C.createdInvocations, 2); |
| 99 expect(div.query('#w') is B, isTrue); | 87 expect(div.query('#w') is B, isTrue); |
| 100 }); | 88 }); |
| 101 | 89 |
| 102 // TODO(vsm): Port additional test from upstream here: | 90 // TODO(vsm): Port additional test from upstream here: |
| 103 // http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/crea
ted-callback.html?r1=156141&r2=156185 | 91 // http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/crea
ted-callback.html?r1=156141&r2=156185 |
| 104 } | 92 } |
| OLD | NEW |