T44d Web · Hidden demos keep still, wide ones scroll whole, pastes read the web's clipboard

This commit is contained in:
ZacharyZhang-NY committed 2026-09-29 22:13:27 -04:00
1 parent 2463bb0ac9
commit 81adec5c47
26 files changed
+211 -101

No files matched your search

+28 -1
View File
@@ -1,4 +1,4 @@
use std::time::Duration;
use std::{cell::Cell, rc::Rc, time::Duration};
use gpui::{
ClipboardItem, Entity, EntityInputHandler, KeyUpEvent, Keystroke, TestAppContext,
@@ -256,3 +256,30 @@ fn a_browser_paste_gives_each_cursor_its_line(cx: &mut TestAppContext) {
})
});
}
#[gpui::test]
fn only_a_focused_editor_blinks(cx: &mut TestAppContext) {
let (editor, cx) = editor("a\nb", cx);
let redraws = Rc::new(Cell::new(0));
let counted = redraws.clone();
let _count = cx.update(|_, cx| cx.observe(&editor, move |_, _| counted.set(counted.get() + 1)));
editor.update(cx, |editor, cx| {
let second = 2..2;
editor.select([second], cx);
});
cx.run_until_parked();
redraws.set(0);
cx.executor().advance_clock(Duration::from_secs(3));
cx.run_until_parked();
assert_eq!(redraws.get(), 0, "an unfocused editor keeps still");
cx.update(|window, cx| {
window.activate_window();
let focus = editor.read(cx).focus.clone();
focus.focus(window, cx);
});
cx.run_until_parked();
redraws.set(0);
cx.executor().advance_clock(Duration::from_secs(3));
cx.run_until_parked();
assert!(redraws.get() > 2, "a focused one blinks");
}