mirror of
https://github.com/lexmount/moli.git
synced 2026-10-19 08:01:35 +00:00
test(history): await child fragment traversal completion explicitly
This commit is contained in:
+28
-21
@@ -98,33 +98,40 @@
|
||||
String(event.navigationType)
|
||||
);
|
||||
};
|
||||
childWindow.removeEventListener('hashchange', onHashchange);
|
||||
childWindow.addEventListener(
|
||||
'hashchange',
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
document.body.setAttribute('data-top-order', topOrder.join(','));
|
||||
document.body.setAttribute(
|
||||
'data-top-currententrychange',
|
||||
String(topCurrentEntryChanges)
|
||||
);
|
||||
document.body.setAttribute('data-child-order', childOrder.join(','));
|
||||
document.body.setAttribute(
|
||||
'data-child-property-order',
|
||||
childPropertyOrder.join(',')
|
||||
);
|
||||
document.body.setAttribute(
|
||||
'data-child-timeout-hash',
|
||||
childWindow.location.hash
|
||||
);
|
||||
document.body.setAttribute(
|
||||
'data-child-timeout-state',
|
||||
String(childWindow.history.state?.step ?? 'null')
|
||||
);
|
||||
document.body.setAttribute('data-child-traversal-complete', 'true');
|
||||
}, 0);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
childWindow.history.go(1);
|
||||
document.body.setAttribute('data-child-sync-hash', childWindow.location.hash);
|
||||
document.body.setAttribute(
|
||||
'data-child-sync-state',
|
||||
String(childWindow.history.state?.step ?? 'null')
|
||||
);
|
||||
childWindow.removeEventListener('hashchange', onHashchange);
|
||||
setTimeout(() => {
|
||||
document.body.setAttribute('data-top-order', topOrder.join(','));
|
||||
document.body.setAttribute(
|
||||
'data-top-currententrychange',
|
||||
String(topCurrentEntryChanges)
|
||||
);
|
||||
document.body.setAttribute('data-child-order', childOrder.join(','));
|
||||
document.body.setAttribute(
|
||||
'data-child-property-order',
|
||||
childPropertyOrder.join(',')
|
||||
);
|
||||
document.body.setAttribute(
|
||||
'data-child-timeout-hash',
|
||||
childWindow.location.hash
|
||||
);
|
||||
document.body.setAttribute(
|
||||
'data-child-timeout-state',
|
||||
String(childWindow.history.state?.step ?? 'null')
|
||||
);
|
||||
}, 50);
|
||||
},
|
||||
{ once: false }
|
||||
);
|
||||
|
||||
@@ -4277,7 +4277,11 @@ async fn child_browsing_context_history_go_one_fragment_traversal_events_stay_wi
|
||||
))
|
||||
.await?;
|
||||
browser
|
||||
.wait_for_page_delay(&mut page, Duration::from_millis(250))
|
||||
.wait_for_selector(
|
||||
&mut page,
|
||||
"body[data-child-traversal-complete='true']",
|
||||
Duration::from_secs(5),
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert!(
|
||||
|
||||
Reference in New Issue
Block a user