Unbork test relying on old keystroke behavior

Previously it would both send the keydown *and then* the action, now
it send the action, and then because there was an action, does not send
the keydown

Co-Authored-By: Conrad Irwin <conrad@zed.dev>
This commit is contained in:
Julia 2024-01-04 15:07:46 -05:00
parent 09b32e6a0e
commit bf8f3e3d68

View File

@ -307,7 +307,10 @@ mod test {
div().id("testview").child(
div()
.key_context("parent")
.on_key_down(cx.listener(|this, _, _| this.saw_key_down = true))
.on_key_down(cx.listener(|this, _, cx| {
cx.stop_propagation();
this.saw_key_down = true
}))
.on_action(
cx.listener(|this: &mut TestView, _: &TestAction, _| {
this.saw_action = true
@ -343,6 +346,7 @@ mod test {
.update(cx, |test_view, cx| cx.focus(&test_view.focus_handle))
.unwrap();
cx.dispatch_keystroke(*window, Keystroke::parse("a").unwrap(), false);
cx.dispatch_keystroke(*window, Keystroke::parse("ctrl-g").unwrap(), false);
window