T44d Web · Hidden demos keep still, wide ones scroll whole, pastes read the web's clipboard
This commit is contained in:
26 files changed
+211
-101
No files matched your search
@@ -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")
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use gpui::{
|
||||
Styled, TestAppContext, VisualTestContext, Window, div, point, px,
|
||||
};
|
||||
|
||||
mod clipboard;
|
||||
mod columns;
|
||||
|
||||
use super::{Column, DataTable, FilterBuilder, FilterRule, Row};
|
||||
|
||||
Reference in new issue
Block a user