Update vim mode tests to use new marked text format

This commit is contained in:
Max Brunsfeld 2022-08-03 17:52:34 -07:00
parent eabd9c02e5
commit afcf5fc95b
7 changed files with 491 additions and 485 deletions

View file

@ -216,7 +216,7 @@ mod test {
async fn test_initially_disabled(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, false).await;
cx.simulate_keystrokes(["h", "j", "k", "l"]);
cx.assert_editor_state("hjkl|");
cx.assert_editor_state("hjklˇ");
}
#[gpui::test]
@ -229,24 +229,24 @@ mod test {
// Editor acts as though vim is disabled
cx.disable_vim();
cx.simulate_keystrokes(["h", "j", "k", "l"]);
cx.assert_editor_state("hjkl|");
cx.assert_editor_state("hjklˇ");
// Selections aren't changed if editor is blurred but vim-mode is still disabled.
cx.set_state("[hjkl}", Mode::Normal);
cx.assert_editor_state("[hjkl}");
cx.set_state("«hjklˇ»", Mode::Normal);
cx.assert_editor_state("«hjklˇ»");
cx.update_editor(|_, cx| cx.blur());
cx.assert_editor_state("[hjkl}");
cx.assert_editor_state("«hjklˇ»");
cx.update_editor(|_, cx| cx.focus_self());
cx.assert_editor_state("[hjkl}");
cx.assert_editor_state("«hjklˇ»");
// Enabling dynamically sets vim mode again and restores normal mode
cx.enable_vim();
assert_eq!(cx.mode(), Mode::Normal);
cx.simulate_keystrokes(["h", "h", "h", "l"]);
assert_eq!(cx.buffer_text(), "hjkl".to_owned());
cx.assert_editor_state("h|jkl");
cx.assert_editor_state("hˇjkl");
cx.simulate_keystrokes(["i", "T", "e", "s", "t"]);
cx.assert_editor_state("hTest|jkl");
cx.assert_editor_state("hTestˇjkl");
// Disabling and enabling resets to normal mode
assert_eq!(cx.mode(), Mode::Insert);
@ -262,7 +262,7 @@ mod test {
cx.set_state(
indoc! {"
The quick brown
fox ju|mps over
fox juˇmps over
the lazy dog"},
Mode::Normal,
);