Kit · K04: compat/kit runs Ely beside the newest GPUI Kit in one window; check.sh holds it to Kit's newest release

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 13:23:23 -04:00
1 parent 98de2a455f
commit 99615e1a0c
10 files changed
+352 -6

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
use gpui_kit::{Focusable, TestAppContext};
use crate::desk::{CODE, focused, open};
fn tab_runs_through_both(cx: &mut TestAppContext, ely_last: bool) {
let (desk, mut cx) = open(cx, ely_last);
let (open_button, line, code) = cx.update(|_, cx| {
let desk = desk.read(cx);
(desk.open.clone(), desk.line.clone(), desk.code.clone())
});
cx.update(|window, cx| window.focus(&open_button, cx));
cx.simulate_keystrokes("tab");
let line_focus = cx.update(|_, cx| line.read(cx).focus_handle(cx));
assert!(
focused(&mut cx, &line_focus),
"Tab leaves Ely's button for Kit's field"
);
cx.simulate_keystrokes("tab");
let code_focus = cx.update(|_, cx| code.read(cx).focus_handle(cx));
assert!(
focused(&mut cx, &code_focus),
"Tab reaches Kit's code editor"
);
cx.simulate_keystrokes("tab");
assert!(
focused(&mut cx, &code_focus),
"Tab stays in the code editor"
);
let text = cx.update(|_, cx| code.read(cx).value().to_string());
assert!(
text.len() > CODE.len() && text.trim() == CODE,
"Tab indents: {text:?}"
);
cx.simulate_keystrokes("shift-tab");
let text = cx.update(|_, cx| code.read(cx).value().to_string());
assert_eq!(text, CODE, "Shift-Tab outdents");
cx.update(|window, cx| window.focus(&line_focus, cx));
cx.simulate_keystrokes("shift-tab");
assert!(
focused(&mut cx, &open_button),
"Shift-Tab returns to Ely's button"
);
}
#[gpui_kit::test]
fn tab_runs_through_both_with_ely_started_last(cx: &mut TestAppContext) {
tab_runs_through_both(cx, true);
}
#[gpui_kit::test]
fn tab_runs_through_both_with_kit_started_last(cx: &mut TestAppContext) {
tab_runs_through_both(cx, false);
}