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 d2018f8510
commit 752e7cba0c
26 files changed
+211 -101

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
use std::{cell::RefCell, rc::Rc};
use gpui::{ClipboardItem, Modifiers, TestAppContext, point, px};
use super::{Grid, settle};
use crate::theme::Theme;
#[gpui::test]
fn a_paste_fills_cells_from_the_cursor(cx: &mut TestAppContext) {
cx.update(|cx| {
Theme::init(cx);
crate::forms::bind_keys(cx);
});
let heard = Rc::new(RefCell::new(Vec::new()));
let seen = heard.clone();
let (_, cx) = cx.add_window_view(|_, _| Grid(seen));
settle(cx);
cx.simulate_click(point(px(48.0), px(42.0)), Modifiers::none());
settle(cx);
cx.update(|_, cx| cx.write_to_clipboard(ClipboardItem::new_string("x\ty\nz\tw".into())));
cx.simulate_keystrokes("cmd-v");
settle(cx);
let cells = |row, col, text: &str| (row, col, text.to_string());
assert_eq!(
*heard.borrow(),
[
cells(0, 0, "x"),
cells(0, 1, "y"),
cells(1, 0, "z"),
cells(1, 1, "w")
]
);
}
+1
View File
@@ -9,6 +9,7 @@ use gpui::{
Styled, TestAppContext, VisualTestContext, Window, div, point, px,
};
mod clipboard;
mod columns;
use super::{Column, DataTable, FilterBuilder, FilterRule, Row};