| 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 |
| 57 main() { | 69 main() { |
| 58 useHtmlConfiguration(); | 70 useHtmlConfiguration(); |
| 59 | 71 |
| 60 // Adapted from Blink's | 72 // Adapted from Blink's |
| 61 // fast/dom/custom/created-callback test. | 73 // fast/dom/custom/created-callback test. |
| 62 | 74 |
| 63 setUp(loadPolyfills); | 75 setUp(loadPolyfills); |
| 64 | 76 |
| 65 test('transfer created callback', () { | 77 test('transfer created callback', () { |
| 66 document.register(A.tag, A); | 78 document.register(A.tag, A); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 83 | 95 |
| 84 Platform.upgradeCustomElements(div); | 96 Platform.upgradeCustomElements(div); |
| 85 | 97 |
| 86 expect(C.createdInvocations, 2); | 98 expect(C.createdInvocations, 2); |
| 87 expect(div.query('#w') is B, isTrue); | 99 expect(div.query('#w') is B, isTrue); |
| 88 }); | 100 }); |
| 89 | 101 |
| 90 // TODO(vsm): Port additional test from upstream here: | 102 // TODO(vsm): Port additional test from upstream here: |
| 91 // http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/crea
ted-callback.html?r1=156141&r2=156185 | 103 // http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/crea
ted-callback.html?r1=156141&r2=156185 |
| 92 } | 104 } |
| OLD | NEW |