Primitives · raise: what opens inside a dialog lies over it
gpui 0.2.2 asserts on a deferred draw inside another, and every dialog, sheet and popover draws inside one, so opening a date field in the snooze or schedule dialog panicked, as would any list, menu or picker opened in an overlay. primitives::raise replaces each deferred draw: at the top it defers as before; inside something raised it leaves a placeholder in the tree, and its layer lays it out on its own, then draws it last. check.sh refuses gpui's deferred anywhere else. The time dialog's rule is now times::ahead, tested for a moment behind, now itself, a moment ahead and another zone; a gpui test picks yesterday in the snooze dialog, sees that it has passed and that nothing is sent, then picks two days ahead and hears that moment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b0a8443a7
commit
9abab5f2ba
20 files changed
+405
-49
No files matched your search
+34
-2
@@ -2,12 +2,13 @@ use gpui::{
|
||||
Context, Entity, IntoElement, Modifiers, ParentElement, Render, SharedString, Styled,
|
||||
TestAppContext, VisualTestContext, Window, div, px,
|
||||
};
|
||||
use jiff::{Timestamp, tz::TimeZone};
|
||||
use jiff::{Timestamp, ToSpan, tz::TimeZone};
|
||||
|
||||
use super::{Mailing, heard, mailing, note, press, settle, setup, tab_to};
|
||||
use crate::{
|
||||
forms,
|
||||
mail::{Label, LabelPicker, SnoozePicker, snooze::snoozes},
|
||||
mail::{Label, LabelPicker, SnoozePicker, snooze::snoozes, times::at_hour},
|
||||
typography::format::system_zone,
|
||||
};
|
||||
|
||||
/// Labels the host keeps, the keys on, and what it heard.
|
||||
@@ -166,3 +167,34 @@ fn the_last_row_asks_for_a_time_of_ones_own(cx: &mut TestAppContext) {
|
||||
assert!(cx.debug_bounds("time-dialog").is_some(), "the dialog shows");
|
||||
assert!(heard(&host, cx).is_empty(), "no time yet");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn the_dialog_takes_only_a_time_ahead_of_now(cx: &mut TestAppContext) {
|
||||
let (host, cx) = mailing(snoozing, cx);
|
||||
tab_to(1, cx);
|
||||
for key in [
|
||||
"enter", "up", "enter", "tab", "enter", "left", "enter", "escape",
|
||||
] {
|
||||
press(key, cx);
|
||||
}
|
||||
assert!(
|
||||
cx.debug_bounds("time-late").is_some(),
|
||||
"yesterday has passed"
|
||||
);
|
||||
for key in ["tab", "tab", "enter"] {
|
||||
press(key, cx);
|
||||
}
|
||||
assert!(heard(&host, cx).is_empty(), "Snooze waits for a time ahead");
|
||||
for key in [
|
||||
"right", "right", "right", "enter", "escape", "tab", "tab", "enter",
|
||||
] {
|
||||
press(key, cx);
|
||||
}
|
||||
let today = Timestamp::now().to_zoned(system_zone("a test")).date();
|
||||
let ahead = at_hour(
|
||||
today.checked_add(2.days()).expect("a day"),
|
||||
0,
|
||||
&TimeZone::UTC,
|
||||
);
|
||||
assert_eq!(heard(&host, cx), [format!("until {ahead}")]);
|
||||
}
|
||||
Reference in new issue
Block a user