diff --git a/crates/vim/src/test.rs b/crates/vim/src/test.rs index df6fac20aca..ab8f75fcb9e 100644 --- a/crates/vim/src/test.rs +++ b/crates/vim/src/test.rs @@ -1447,6 +1447,29 @@ async fn test_pending_input_mapping_output_undo(cx: &mut gpui::TestAppContext) { cx.assert_state("ˇone", Mode::Normal); } +#[perf] +#[gpui::test] +async fn test_pending_input_mapping_output_undo_delay(cx: &mut gpui::TestAppContext) { + let mut cx = VimTestContext::new(cx, true).await; + + cx.update(|_, cx| { + cx.bind_keys([KeyBinding::new( + "a b c", + HandleInput("d".to_string()), + Some("vim_mode == insert"), + )]) + }); + + cx.set_state("ˇone", Mode::Normal); + cx.simulate_keystrokes("i a b"); + cx.executor().advance_clock(Duration::from_millis(1500)); + cx.run_until_parked(); + cx.assert_state("abˇone", Mode::Insert); + + cx.simulate_keystrokes("escape u"); + cx.assert_state("ˇone", Mode::Normal); +} + #[perf] #[gpui::test] async fn test_lsp_completions_undo(cx: &mut gpui::TestAppContext) {