mirror of
https://github.com/lexmount/moli.git
synced 2026-10-26 16:00:54 +00:00
test(history): snapshot child traversal events after completion
This commit is contained in:
+12
-5
@@ -17,6 +17,7 @@
|
||||
document.body.setAttribute('data-done', '1');
|
||||
|
||||
const childWindow = iframe.contentWindow;
|
||||
let finishTraversal;
|
||||
|
||||
childWindow.addEventListener('popstate', () => {
|
||||
childOrder.push('child-popstate');
|
||||
@@ -29,6 +30,7 @@
|
||||
document.body.setAttribute('data-child-new', event.newURL);
|
||||
queueMicrotask(() => {
|
||||
childOrder.push('child-hashchange-microtask');
|
||||
finishTraversal?.();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,14 +43,19 @@
|
||||
document.body.removeAttribute('data-child-old');
|
||||
document.body.removeAttribute('data-child-new');
|
||||
|
||||
const traversalCompleted = new Promise(resolve => {
|
||||
finishTraversal = resolve;
|
||||
});
|
||||
childWindow.history.back();
|
||||
document.body.setAttribute('data-child-sync-hash', childWindow.location.hash);
|
||||
|
||||
setTimeout(() => {
|
||||
document.body.setAttribute('data-top-order', topOrder.join(','));
|
||||
document.body.setAttribute('data-child-order', childOrder.join(','));
|
||||
document.body.setAttribute('data-child-timeout-hash', childWindow.location.hash);
|
||||
}, 50);
|
||||
traversalCompleted.then(() => {
|
||||
setTimeout(() => {
|
||||
document.body.setAttribute('data-top-order', topOrder.join(','));
|
||||
document.body.setAttribute('data-child-order', childOrder.join(','));
|
||||
document.body.setAttribute('data-child-timeout-hash', childWindow.location.hash);
|
||||
}, 50);
|
||||
});
|
||||
}, 50);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -4073,9 +4073,7 @@ async fn child_browsing_context_fragment_traversal_events_stay_window_local() ->
|
||||
"/compat/window-child-browsing-context-fragment-traversal-events-are-window-local",
|
||||
))
|
||||
.await?;
|
||||
browser
|
||||
.wait_for_page_delay(&mut page, Duration::from_millis(250))
|
||||
.await?;
|
||||
wait_for_body_attribute(&browser, &mut page, "data-child-timeout-hash", "#one").await?;
|
||||
|
||||
assert!(
|
||||
page.serialize_html_async()
|
||||
|
||||
Reference in New Issue
Block a user