test(js): cover native nav escape hatches
Cover page-swap guards that preserve native browser navigation for modified clicks, non-primary buttons, downloads, blank targets, cross-origin links, and prevented events. req: page_swap/007 req: failure/006
This commit is contained in:
@@ -115,6 +115,20 @@ fn runtime_exposes_page_swap_hooks() {
|
||||
assert!(source.contains("location.href = href"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_preserves_native_navigation_escape_hatches() {
|
||||
// req: page_swap/007 req: failure/006
|
||||
let source = slhx_js::RUNTIME_JS;
|
||||
|
||||
assert!(source.contains("function sameOriginNav(event, anchor)"));
|
||||
assert!(source.contains("!event.defaultPrevented"));
|
||||
assert!(source.contains("event.button === 0"));
|
||||
assert!(source.contains("!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey"));
|
||||
assert!(source.contains("anchor.origin === location.origin"));
|
||||
assert!(source.contains("!anchor.download"));
|
||||
assert!(source.contains("anchor.target !== \"_blank\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_refuses_partial_updates_on_fingerprint_mismatch() {
|
||||
// req: abi/003 req: abi/004 req: runtime/004
|
||||
|
||||
Reference in New Issue
Block a user