mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-24 01:12:58 -04:00
Rename testing.eventually to testing.onload, to make it more clear
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
a1.play();
|
||||
cb.push(a1.playState);
|
||||
});
|
||||
testing.eventually(() => testing.expectEqual(['idle', 'running', 'finished', true], cb));
|
||||
testing.onload(() => testing.expectEqual(['idle', 'running', 'finished', true], cb));
|
||||
</script>
|
||||
|
||||
<!-- <script id=startTime>
|
||||
@@ -39,7 +39,7 @@
|
||||
// onfinish callback should be scheduled and called asynchronously
|
||||
a3.onfinish = function() { calls.push('finish'); };
|
||||
a3.play();
|
||||
testing.eventually(() => testing.expectEqual(['finish'], calls));
|
||||
testing.onload(() => testing.expectEqual(['finish'], calls));
|
||||
</script>
|
||||
|
||||
<script id=pause>
|
||||
@@ -52,7 +52,7 @@
|
||||
a4.pause();
|
||||
cb4.push(a4.playState)
|
||||
});
|
||||
testing.eventually(() => testing.expectEqual(['running', 'paused'], cb4));
|
||||
testing.onload(() => testing.expectEqual(['running', 'paused'], cb4));
|
||||
</script>
|
||||
|
||||
<script id=finish>
|
||||
@@ -65,6 +65,6 @@
|
||||
cb5.push(a5.playState);
|
||||
a5.play();
|
||||
});
|
||||
testing.eventually(() => testing.expectEqual(['idle', 'finished'], cb5));
|
||||
testing.onload(() => testing.expectEqual(['idle', 'finished'], cb5));
|
||||
</script>
|
||||
-->
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
document.fonts.load("italic bold 16px Roboto");
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, loading);
|
||||
testing.expectEqual(true, loadingdone);
|
||||
});
|
||||
|
||||
@@ -498,7 +498,7 @@
|
||||
testing.expectEqual('.async-test', sheet.cssRules[0].selectorText);
|
||||
replacedAsync = true;
|
||||
});
|
||||
testing.eventually(() => testing.expectTrue(replacedAsync));
|
||||
testing.onload(() => testing.expectTrue(replacedAsync));
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
document.open();
|
||||
}, 5);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
// The element should be gone now
|
||||
const afterOpen = document.getElementById('will_be_removed');
|
||||
testing.expectEqual(null, afterOpen);
|
||||
|
||||
@@ -532,6 +532,6 @@
|
||||
testing.expectEqual(true, result);
|
||||
});
|
||||
|
||||
testing.eventually(() => testing.expectEqual(true, asyncBlockDispatched));
|
||||
testing.onload(() => testing.expectEqual(true, asyncBlockDispatched));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
testing.eventually(() => testing.expectEqual(true, result));
|
||||
testing.onload(() => testing.expectEqual(true, result));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
const img = document.createElement("img");
|
||||
img.addEventListener("load", () => { fired = true; });
|
||||
document.body.appendChild(img);
|
||||
testing.eventually(() => testing.expectEqual(false, fired));
|
||||
testing.onload(() => testing.expectEqual(false, fired));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
document.body.appendChild(img);
|
||||
img.src = "https://cdn.lightpanda.io/website/assets/images/docs/hn.png";
|
||||
|
||||
testing.eventually(() => testing.expectEqual(true, result));
|
||||
testing.onload(() => testing.expectEqual(true, result));
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
});
|
||||
input.setSelectionRange(1, 4);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(5, eventCount);
|
||||
testing.expectEqual('selectionchange', lastEvent.type);
|
||||
testing.expectEqual(input, lastEvent.target);
|
||||
@@ -247,7 +247,7 @@
|
||||
|
||||
input.select();
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, eventCount);
|
||||
testing.expectEqual('select', lastEvent.type);
|
||||
testing.expectEqual(input, lastEvent.target);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
link.rel = 'stylesheet';
|
||||
link.addEventListener('load', () => { fired = true; });
|
||||
document.head.appendChild(link);
|
||||
testing.eventually(() => testing.expectEqual(false, fired));
|
||||
testing.onload(() => testing.expectEqual(false, fired));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
link.href = 'https://lightpanda.io/opensource-browser/15';
|
||||
link.addEventListener('load', () => { fired = true; });
|
||||
document.head.appendChild(link);
|
||||
testing.eventually(() => testing.expectEqual(false, fired));
|
||||
testing.onload(() => testing.expectEqual(false, fired));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
// then set href.
|
||||
link.href = 'https://lightpanda.io/opensource-browser/15';
|
||||
|
||||
testing.eventually(() => testing.expectEqual(true, result));
|
||||
testing.onload(() => testing.expectEqual(true, result));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
});
|
||||
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
results.forEach((r) => {
|
||||
testing.expectEqual(true, r);
|
||||
});
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
script1.async = false;
|
||||
script1.src = "dynamic1.js";
|
||||
document.getElementsByTagName('head')[0].appendChild(script1);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, loaded1);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script id=no_double_execute>
|
||||
document.getElementsByTagName('head')[0].appendChild(script1);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, loaded1);
|
||||
});
|
||||
</script>
|
||||
@@ -25,7 +25,7 @@
|
||||
const script2a = document.createElement('script');
|
||||
script2a.src = "dynamic2.js";
|
||||
document.getElementsByTagName('head')[0].appendChild(script2a);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(2, loaded2);
|
||||
});
|
||||
</script>
|
||||
@@ -38,7 +38,7 @@
|
||||
</script>
|
||||
|
||||
<script id=src_after_append>
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(2, loaded2);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
s6.type = 'module';
|
||||
s6.textContent = 'window.module_executed = true;';
|
||||
document.head.appendChild(s6);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectTrue(window.module_executed);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/script/empty.js', s.src);
|
||||
document.head.appendChild(s);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, dom_load);
|
||||
testing.expectEqual(true, attribute_load);
|
||||
});
|
||||
|
||||
@@ -427,7 +427,7 @@
|
||||
div.setAttribute('slot', 'content');
|
||||
host.appendChild(div);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls);
|
||||
});
|
||||
}
|
||||
@@ -455,7 +455,7 @@
|
||||
|
||||
div.setAttribute('slot', 'other');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls);
|
||||
});
|
||||
}
|
||||
@@ -483,7 +483,7 @@
|
||||
|
||||
div.remove();
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls);
|
||||
});
|
||||
}
|
||||
@@ -511,7 +511,7 @@
|
||||
|
||||
div.slot = 'other';
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
testing.eventually(() => testing.expectEqual(true, result));
|
||||
testing.onload(() => testing.expectEqual(true, result));
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
|
||||
textarea.select();
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, eventCount);
|
||||
testing.expectEqual('select', lastEvent.type);
|
||||
testing.expectEqual(textarea, lastEvent.target);
|
||||
@@ -295,7 +295,7 @@
|
||||
});
|
||||
textarea.setSelectionRange(1, 4);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(5, eventCount);
|
||||
testing.expectEqual('selectionchange', lastEvent.type);
|
||||
testing.expectEqual(textarea, lastEvent.target);
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
|
||||
<script id=abortsignal_timeout>
|
||||
var s3 = AbortSignal.timeout(10);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, s3.aborted);
|
||||
testing.expectEqual('TimeoutError', s3.reason);
|
||||
testing.expectError('Error: TimeoutError', () => {
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
window.postMessage('test data', '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('test data', receivedEvent.data);
|
||||
testing.expectEqual(window, receivedEvent.source);
|
||||
testing.expectEqual('message', receivedEvent.type);
|
||||
@@ -81,7 +81,7 @@
|
||||
const testObj = { type: 'test', value: 123, nested: { key: 'value' } };
|
||||
window.postMessage(testObj, '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(testObj, receivedData);
|
||||
});
|
||||
}
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
window.postMessage(42, '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(42, received);
|
||||
});
|
||||
}
|
||||
@@ -129,7 +129,7 @@
|
||||
const arr = [1, 2, 3, 'test'];
|
||||
window.postMessage(arr, '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(arr, received);
|
||||
});
|
||||
}
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
window.postMessage(null, '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(null, received);
|
||||
});
|
||||
}
|
||||
@@ -163,7 +163,7 @@
|
||||
|
||||
window.postMessage('test', '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('http://127.0.0.1:9582', receivedOrigin);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
window.postMessage('trigger', '*');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(2, count);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
$('#f2').src = 'support/sub2.html';
|
||||
testing.expectEqual(true, true);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(undefined, window[20]);
|
||||
|
||||
testing.expectEqual(window, window[1].top);
|
||||
@@ -84,7 +84,7 @@
|
||||
f3.src = 'invalid'; // still fires load!
|
||||
document.documentElement.appendChild(f3);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('f1_onload_loaded', window.f1_onload);
|
||||
testing.expectEqual(true, f3_load_event);
|
||||
});
|
||||
@@ -98,7 +98,7 @@
|
||||
f4.src = "about:blank";
|
||||
document.documentElement.appendChild(f4);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual("<html><head></head><body></body></html>", f4.contentDocument.documentElement.outerHTML);
|
||||
});
|
||||
}
|
||||
@@ -112,7 +112,7 @@
|
||||
document.documentElement.appendChild(f5);
|
||||
f5.src = "about:blank";
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual("<html><head></head><body></body></html>", f5.contentDocument.documentElement.outerHTML);
|
||||
});
|
||||
}
|
||||
@@ -144,14 +144,14 @@
|
||||
let i = document.createElement('iframe');
|
||||
document.documentElement.appendChild(i);
|
||||
i.contentWindow.location.href = 'support/page.html';
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('<html><head></head><body>a-page\n</body></html>', i.contentDocument.documentElement.outerHTML);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id=count>
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(9, window.length);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
iframe.contentWindow.postMessage('ping', '*');
|
||||
});
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('pong', reply.data);
|
||||
testing.expectEqual(testing.ORIGIN, reply.origin);
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<a id=l1 target=f1 href=support/page.html></a>
|
||||
<script id=anchor>
|
||||
$('#l1').click();
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('<html><head></head><body>a-page\n</body></html>', $('#frame1').contentDocument.documentElement.outerHTML);
|
||||
});
|
||||
</script>
|
||||
@@ -21,7 +21,7 @@
|
||||
form.action = 'support/page.html';
|
||||
form.submit();
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('<html><head></head><body>a-page\n</body></html>', frame2.contentDocument.documentElement.outerHTML);
|
||||
});
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
<script id=formtarget>
|
||||
{
|
||||
$('#submit1').click();
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('<html><head></head><body>a-page\n</body></html>', $('#f3').contentDocument.documentElement.outerHTML);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// If support/history.html has a failed assertion, it'll log the error and
|
||||
// stop the script. If it succeeds, it'll set support_history_completed
|
||||
// which we can use here to assume everything passed.
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, window.support_history_completed);
|
||||
testing.expectEqual(true, window.support_history_popstateEventFired);
|
||||
testing.expectEqual({testInProgress: true }, window.support_history_popstateEventState);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
observer.observe(target);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, callbackCalled);
|
||||
testing.expectEqual(1, entries.length);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
count += 1;
|
||||
}).observe(div);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(0, count);
|
||||
});
|
||||
}
|
||||
@@ -56,7 +56,7 @@
|
||||
}).observe(div1);
|
||||
|
||||
div2.appendChild(div1);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, count);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
observer.observe(target);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, callCount);
|
||||
|
||||
observer.disconnect();
|
||||
@@ -22,7 +22,7 @@
|
||||
const observer2 = new IntersectionObserver(() => {});
|
||||
observer2.observe(target);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
observer2.disconnect();
|
||||
testing.expectEqual(1, callCount);
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
observer.observe(target1);
|
||||
observer.observe(target2);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(2, entryCount);
|
||||
testing.expectTrue(seenTargets.has(target1));
|
||||
testing.expectTrue(seenTargets.has(target2));
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
observer.unobserve(target1);
|
||||
observer.observe(target2);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
// Should only see target2, not target1
|
||||
testing.expectEqual(1, seenTargets.length);
|
||||
testing.expectEqual(target2, seenTargets[0]);
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
|
||||
let replaced = false;
|
||||
css.replace('body{}').then(() => replaced = true);
|
||||
testing.eventually(() => testing.expectEqual(true, replaced));
|
||||
testing.onload(() => testing.expectEqual(true, replaced));
|
||||
</script>
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
cb.push('finished');
|
||||
cb.push(x == a1);
|
||||
});
|
||||
testing.eventually(() => testing.expectEqual(['finished', true], cb));
|
||||
testing.onload(() => testing.expectEqual(['finished', true], cb));
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
count += 1;
|
||||
}).observe(div);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(0, count);
|
||||
});
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
}).observe(div1);
|
||||
|
||||
div2.appendChild(div1);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, count);
|
||||
});
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
observer.observe(div1);
|
||||
testing.expectEqual(0, count);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, count);
|
||||
});
|
||||
}
|
||||
@@ -75,7 +75,7 @@
|
||||
testing.expectEqual(0, count);
|
||||
|
||||
observer.unobserve(div1);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(0, count);
|
||||
});
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
testing.expectEqual(0, count);
|
||||
observer.disconnect();
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(0, count);
|
||||
});
|
||||
}
|
||||
@@ -117,7 +117,7 @@
|
||||
document.body.appendChild(div1);
|
||||
new IntersectionObserver(entries => { entry = entries[0]; }).observe(div1);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(125, entry.boundingClientRect.x);
|
||||
testing.expectEqual(1, entry.intersectionRatio);
|
||||
testing.expectEqual(125, entry.intersectionRect.x);
|
||||
@@ -150,7 +150,7 @@
|
||||
observer.observe(div);
|
||||
capture.push('post-observe');
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual([
|
||||
'pre-append',
|
||||
'post-append',
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<script id=timeout>
|
||||
var s3 = AbortSignal.timeout(10);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, s3.aborted);
|
||||
testing.expectEqual('TimeoutError', s3.reason);
|
||||
testing.expectError('Error: TimeoutError', () => {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
popstateEventState = event.state;
|
||||
});
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, popstateEventFired);
|
||||
testing.expectEqual(state, popstateEventState);
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
popstateEventState = event.state;
|
||||
};
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, popstateEventFired);
|
||||
testing.expectEqual(state, popstateEventState);
|
||||
})
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
// inline script should ignore defer and async attributes. If we don't do
|
||||
// this correctly, we'd end up in an infinite loop
|
||||
// https://github.com/lightpanda-io/browser/issues/1014
|
||||
testing.eventually(() => testing.expectEqual(2, dyn1_loaded));
|
||||
testing.onload(() => testing.expectEqual(2, dyn1_loaded));
|
||||
</script>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
lp.appendChild(div);
|
||||
testing.expectEqual(slot, div.assignedSlot);
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls)
|
||||
});
|
||||
}
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
const div = $('#s2');
|
||||
div.removeAttribute('slot');
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls)
|
||||
});
|
||||
}
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
const div = $('#s3');
|
||||
div.slot = 'other';
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls)
|
||||
});
|
||||
}
|
||||
@@ -154,7 +154,7 @@
|
||||
div.slot = 'other';
|
||||
lp.appendChild(div);
|
||||
div.slot = 'slot-1'
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls)
|
||||
});
|
||||
}
|
||||
@@ -172,7 +172,7 @@
|
||||
});
|
||||
|
||||
$('#s5').remove();
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, calls)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
start = timestamp;
|
||||
}
|
||||
requestAnimationFrame(step);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, start > 0)
|
||||
});
|
||||
|
||||
@@ -24,23 +24,23 @@
|
||||
start = 0;
|
||||
});
|
||||
cancelAnimationFrame(request_id);
|
||||
testing.eventually(() => testing.expectEqual(true, start > 0));
|
||||
testing.onload(() => testing.expectEqual(true, start > 0));
|
||||
</script>
|
||||
|
||||
<script id=setTimeout>
|
||||
let longCall = false;
|
||||
window.setTimeout(() => {longCall = true}, 5001);
|
||||
testing.eventually(() => testing.expectEqual(false, longCall));
|
||||
testing.onload(() => testing.expectEqual(false, longCall));
|
||||
|
||||
let wst1 = 0;
|
||||
window.setTimeout(() => {wst1 += 1}, 1);
|
||||
testing.eventually(() => testing.expectEqual(1, wst1));
|
||||
testing.onload(() => testing.expectEqual(1, wst1));
|
||||
|
||||
let wst2 = 1;
|
||||
window.setTimeout((a, b) => {
|
||||
wst2 = a + b;
|
||||
}, 1, 2, 3);
|
||||
testing.eventually(() => testing.expectEqual(5, wst2));
|
||||
testing.onload(() => testing.expectEqual(5, wst2));
|
||||
</script>
|
||||
|
||||
<script id=eventTarget>
|
||||
@@ -70,7 +70,7 @@
|
||||
<script id=queueMicroTask>
|
||||
var qm = false;
|
||||
window.queueMicrotask(() => {qm = true });
|
||||
testing.eventually(() => testing.expectEqual(true, qm));
|
||||
testing.onload(() => testing.expectEqual(true, qm));
|
||||
</script>
|
||||
|
||||
<script id=DOMContentLoaded>
|
||||
@@ -79,7 +79,7 @@
|
||||
window.addEventListener('DOMContentLoaded', (e) => {
|
||||
dcl = e.target == document;
|
||||
});
|
||||
testing.eventually(() => testing.expectEqual(true, dcl));
|
||||
testing.onload(() => testing.expectEqual(true, dcl));
|
||||
</script>
|
||||
|
||||
<script id=window.onload>
|
||||
@@ -97,7 +97,7 @@
|
||||
window.onload = callback;
|
||||
testing.expectEqual(callback, window.onload);
|
||||
|
||||
testing.eventually(() => testing.expectEqual(true, isDocumentTarget));
|
||||
testing.onload(() => testing.expectEqual(true, isDocumentTarget));
|
||||
</script>
|
||||
|
||||
<script id=reportError>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = blob_url;
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('Hello Blob', iframe.contentDocument.getElementById('test').textContent);
|
||||
});
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
document.body.appendChild(iframe2);
|
||||
iframe2.src = url2;
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual('First', iframe1.contentDocument.body.textContent);
|
||||
testing.expectEqual('Second', iframe2.contentDocument.body.textContent);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
call1 = true;
|
||||
});
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(document, ex1.target);
|
||||
testing.expectEqual('DOMContentLoaded', ex1.type);
|
||||
testing.expectEqual(true, call1);
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
// With buffered: true, existing marks should be delivered
|
||||
observer.observe({ type: "mark", buffered: true });
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, receivedEntries !== null);
|
||||
testing.expectEqual(2, receivedEntries.length);
|
||||
testing.expectEqual("early1", receivedEntries[0].name);
|
||||
|
||||
@@ -582,7 +582,7 @@
|
||||
document.removeEventListener('selectionchange', listener);
|
||||
textNode.textContent = "The quick brown fox";
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(14, eventCount);
|
||||
testing.expectEqual('selectionchange', lastEvent.type);
|
||||
testing.expectEqual(document, lastEvent.target);
|
||||
|
||||
@@ -52,10 +52,10 @@
|
||||
throw new Error('no error');
|
||||
}
|
||||
|
||||
function eventually(cb) {
|
||||
function onload(cb) {
|
||||
const script_id = _currentScriptId();
|
||||
if (!script_id) {
|
||||
throw new Error('testing.eventually called outside of a script');
|
||||
throw new Error('testing.onload called outside of a script');
|
||||
}
|
||||
eventuallies.push({
|
||||
callback: cb,
|
||||
@@ -110,7 +110,7 @@
|
||||
expectEqual: expectEqual,
|
||||
expectError: expectError,
|
||||
withError: withError,
|
||||
eventually: eventually,
|
||||
onload: onload,
|
||||
IS_TEST_RUNNER: IS_TEST_RUNNER,
|
||||
HOST: '127.0.0.1',
|
||||
ORIGIN: 'http://127.0.0.1:9582',
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
testing.expectEqual(window, e.currentTarget);
|
||||
}
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, called);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Verify: handler fires, "event" parameter is a proper Event, and handler is a function.
|
||||
let loadEvent = null;
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual("function", typeof document.body.onload);
|
||||
testing.expectTrue(loadEvent instanceof Event);
|
||||
testing.expectEqual("load", loadEvent.type);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Verify: handler fires exactly once, and body.onload reflects to window.onload.
|
||||
let called = 0;
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
// The attribute handler should have fired exactly once.
|
||||
testing.expectEqual(1, called);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
testing.expectEqual(true, timer1 != timer2);
|
||||
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(true, set_interval1);
|
||||
testing.expectEqual(false, set_interval2);
|
||||
});
|
||||
@@ -29,7 +29,7 @@
|
||||
window.setTimeout((a, b) => {
|
||||
wst2 = a + b;
|
||||
}, 1, 2, 3);
|
||||
testing.eventually(() => testing.expectEqual(5, wst2));
|
||||
testing.onload(() => testing.expectEqual(5, wst2));
|
||||
</script>
|
||||
|
||||
<script id=invalid-timer-clear>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
// noop
|
||||
window.removeEventListener('load', fn);
|
||||
testing.eventually(() => {
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(1, call1);
|
||||
testing.expectEqual(2, call2);
|
||||
});
|
||||
@@ -285,6 +285,6 @@
|
||||
unhandledCalled += 1;
|
||||
});
|
||||
Promise.reject({x: 'Fail'});
|
||||
testing.eventually(() => testing.expectEqual(2, unhandledCalled));
|
||||
testing.onload(() => testing.expectEqual(2, unhandledCalled));
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user