The dispatch needle is the statement, not any lookup
Browse files at this commit44ab0de3ad38390e77c4b730d3e0495706baae3aParent: 87eae13- test
- the dispatch needle is the statement, not any lookup
1 changed file +14 -0
- crates/app/src/tests/view.rs +14 -0
crates/app/src/tests/view.rsmodified+14 -0
| @@ -1107,6 +1107,20 @@ fn an_open_card_does_not_swallow_the_document_chords() { | ||
| 1107 | 1107 | stance_rs[..dispatch].contains("this.keymap.lookup(key, ctrl)"), |
| 1108 | 1108 | "the dispatch no longer goes through the keymap, so a rebind would leave it behind" |
| 1109 | 1109 | ); |
| 1110 | + // The *statement* that dispatches, not just some `keymap.lookup` before it: | |
| 1111 | + // the hold gate at the top of the handler resolves the same pair, so a needle | |
| 1112 | + // that only asks for the lookup is satisfied by a dispatch resolving the | |
| 1113 | + // action some other way entirely. | |
| 1114 | + let resolve = stance_rs | |
| 1115 | + .find("if let Some(action) = this.keymap.lookup(key, ctrl)") | |
| 1116 | + .expect("the dispatch no longer resolves an action through the keymap"); | |
| 1117 | + let stmt = &stance_rs[resolve..]; | |
| 1118 | + let stmt = &stmt[..stmt.find('{').expect("the dispatch statement has no block")]; | |
| 1119 | + assert!( | |
| 1120 | + stmt.contains("card_safe_action("), | |
| 1121 | + "the dispatch resolves an action and never asks whether a card may take \ | |
| 1122 | + it, so an open card eats the document chords again" | |
| 1123 | + ); | |
| 1110 | 1124 | for (guard, label) in [ |
| 1111 | 1125 | ("if this.param_card_key(", "the cards' own key branches"), |
| 1112 | 1126 | ("if this.card_open()", "the blanket modal guard"), |