Fix cmd-k left
This commit is contained in:
parent
7ec4f22202
commit
c5d7c8e122
4 changed files with 62 additions and 15 deletions
|
@ -34,6 +34,7 @@ use std::{
|
|||
atomic::{AtomicBool, Ordering::SeqCst},
|
||||
Arc,
|
||||
},
|
||||
time::Duration,
|
||||
};
|
||||
use unindent::Unindent as _;
|
||||
|
||||
|
@ -5945,3 +5946,26 @@ async fn test_right_click_menu_behind_collab_panel(cx: &mut TestAppContext) {
|
|||
});
|
||||
assert!(cx.debug_bounds("MENU_ITEM-Close").is_some());
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_cmd_k_left(cx: &mut TestAppContext) {
|
||||
let client = TestServer::start1(cx).await;
|
||||
let (workspace, cx) = client.build_test_workspace(cx).await;
|
||||
|
||||
cx.simulate_keystrokes("cmd-n");
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
assert!(workspace.items(cx).collect::<Vec<_>>().len() == 1);
|
||||
});
|
||||
cx.simulate_keystrokes("cmd-k left");
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
assert!(workspace.items(cx).collect::<Vec<_>>().len() == 2);
|
||||
});
|
||||
cx.simulate_keystrokes("cmd-k");
|
||||
// sleep for longer than the timeout in keyboard shortcut handling
|
||||
// to verify that it doesn't fire in this case.
|
||||
cx.executor().advance_clock(Duration::from_secs(2));
|
||||
cx.simulate_keystrokes("left");
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
assert!(workspace.items(cx).collect::<Vec<_>>().len() == 3);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -127,6 +127,11 @@ impl TestServer {
|
|||
(client_a, client_b, channel_id)
|
||||
}
|
||||
|
||||
pub async fn start1<'a>(cx: &'a mut TestAppContext) -> TestClient {
|
||||
let mut server = Self::start(cx.executor().clone()).await;
|
||||
server.create_client(cx, "user_a").await
|
||||
}
|
||||
|
||||
pub async fn reset(&self) {
|
||||
self.app_state.db.reset();
|
||||
let epoch = self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue