Index: LayoutTests/fast/dom/custom/ready-callback.html |
diff --git a/LayoutTests/fast/dom/custom/ready-callback.html b/LayoutTests/fast/dom/custom/ready-callback.html |
index 3ce7e522af09fb303ee0e5182d192dcf4ba4d31b..4cb8680ec0187288337fe589761447be610b429b 100644 |
--- a/LayoutTests/fast/dom/custom/ready-callback.html |
+++ b/LayoutTests/fast/dom/custom/ready-callback.html |
@@ -2,33 +2,37 @@ |
<script src="../../../resources/testharness.js"></script> |
<script src="../../../resources/testharnessreport.js"></script> |
<body> |
+<x-a id="a"></x-a> |
+<x-a id="b"></x-a> |
<script> |
-test(function () { |
- var readyInvocations = 0; |
- function ready() { |
- readyInvocations++; |
- } |
+t = async_test('ready callback'); |
+t.calls = []; |
- var getterInvocations = 0; |
- function getter() { |
- getterInvocations++; |
- return ready; |
- } |
+t.step(function () { |
+ var proto = Object.create(HTMLElement.prototype); |
+ proto.readyCallback = function () { |
+ t.calls.push(this.id + ' ready'); |
+ }; |
- function failer() { |
- assert_unreached('the ready callback must not be retrieved after registration'); |
- } |
- |
- var proto = Object.create(HTMLElement.prototype, { |
- readyCallback: { |
- get: getter |
- } |
- }); |
var ctor = document.register('x-a', {prototype: proto}); |
- assert_equals(getterInvocations, 1, 'the ready callback must have been retrieved'); |
+ var call_set = t.calls.slice(); |
+ call_set.sort(); |
+ assert_array_equals(call_set, ['a ready', 'b ready'], 'document.register must invoke the ready lifecycle callback for upgrade candidates'); |
+ |
+ t.calls = []; |
+ new ctor(); |
+ assert_array_equals(t.calls, [' ready'], 'invoking the generated constructor must invoke the ready lifecycle callback'); |
- proto.readyCallback = failer; |
- var element = new ctor(); |
- assert_equals(readyInvocations, 1, 'the ready callback retrieved at registration must be invoked'); |
-}, 'transfer ready callback'); |
+ t.calls = []; |
+ var div = document.createElement('div'); |
+ div.innerHTML = '<x-a id="c"></x-a>'; |
+ assert_array_equals(t.calls, [], 'parsing this fragment must not synchronously invoke the ready lifecycle callback'); |
+}); |
+</script> |
+<script> |
+t.step(function () { |
+ assert_array_equals(t.calls, ['c ready'], 'the ready callback should have been invoked at the microtask checkpoint'); |
+ t.done(); |
+ t = null; |
+}); |
</script> |