From 44ab0de3ad38390e77c4b730d3e0495706baae3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 24 Sep 2026 14:34:59 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20test(keys):=20the=20dispatch=20n?= =?UTF-8?q?eedle=20is=20the=20statement,=20not=20any=20lookup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The needle was satisfied by the hold gate's own `this.keymap.lookup(key, ctrl)` at the top of the handler, so a dispatch that resolved the action another way kept the test green (verifier finding H3). The statement is now read on its own -- from its `if let Some(action) = ...` to its opening brace -- and must contain the `card_safe_action(` call that decides the stroke. --- crates/app/src/tests/view.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/app/src/tests/view.rs b/crates/app/src/tests/view.rs index a8c45d1..a161600 100644 --- a/crates/app/src/tests/view.rs +++ b/crates/app/src/tests/view.rs @@ -1107,6 +1107,20 @@ fn an_open_card_does_not_swallow_the_document_chords() { stance_rs[..dispatch].contains("this.keymap.lookup(key, ctrl)"), "the dispatch no longer goes through the keymap, so a rebind would leave it behind" ); + // The *statement* that dispatches, not just some `keymap.lookup` before it: + // the hold gate at the top of the handler resolves the same pair, so a needle + // that only asks for the lookup is satisfied by a dispatch resolving the + // action some other way entirely. + let resolve = stance_rs + .find("if let Some(action) = this.keymap.lookup(key, ctrl)") + .expect("the dispatch no longer resolves an action through the keymap"); + let stmt = &stance_rs[resolve..]; + let stmt = &stmt[..stmt.find('{').expect("the dispatch statement has no block")]; + assert!( + stmt.contains("card_safe_action("), + "the dispatch resolves an action and never asks whether a card may take \ + it, so an open card eats the document chords again" + ); for (guard, label) in [ ("if this.param_card_key(", "the cards' own key branches"), ("if this.card_open()", "the blanket modal guard"),