Calendar · Editing: an event's editor, its repeats, reminders and open times
EventEditor puts an event's parts in a form: its title, whole days or hours, where, its color, how it repeats, its reminders and notes. Save waits for a title and an end after the start and hands on an EventDraft; Cancel and Delete show when the owner handles them. A new draft from the owner starts the editor over. RecurrenceEditor sets a rule after RFC 5545: daily, weekly on its days, monthly or yearly, every so many, until a day or a count. A line reads the rule back with the next days it falls on. ReminderPicker keeps reminders from a fixed list, soonest first, and Add brings the nearest one not yet set. AvailabilityPicker counts the open slots of each day and lists the chosen day's, around what is busy, inside working hours and after now. FormField filled its column with a percent width, which taffy 0.9 leaves at content width when a block measures the column first and the width comes out the same: at 280px the editor's fields shrank to their labels. It now fills with min_w_full, as new roots do; older roots move over in T44.
This commit is contained in:
1 parent
48ff348357
commit
0bcfd82bf3
18 files changed
+1856
-12
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use gpui::{
|
||||
AppContext as _, Context, Entity, IntoElement, KeyUpEvent, Keystroke, ParentElement, Render,
|
||||
TestAppContext, VisualTestContext, Window, div,
|
||||
AppContext as _, Context, Entity, InteractiveElement, IntoElement, KeyUpEvent, Keystroke,
|
||||
ParentElement, Render, Styled, TestAppContext, VisualTestContext, Window, div, px,
|
||||
};
|
||||
|
||||
use super::setup;
|
||||
@@ -134,3 +134,36 @@ fn field_array_buttons_remove_their_own_row_and_add_one(cx: &mut TestAppContext)
|
||||
["a", "c", "new"]
|
||||
);
|
||||
}
|
||||
|
||||
/// A field over a long line in a column that a padded block measures by content.
|
||||
struct Narrow;
|
||||
|
||||
impl Render for Narrow {
|
||||
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||
let control = div().debug_selector(|| "narrow-control".into()).h_2();
|
||||
div().w(px(280.)).flex().flex_col().child(
|
||||
div().p_5().child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.child(FormField::new("narrow", "Name").child(control))
|
||||
.child("A line long enough to wrap in a narrow card, so the column fills it."),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_field_fills_a_column_its_block_measures_by_content(cx: &mut TestAppContext) {
|
||||
setup(cx);
|
||||
let (_, cx) = cx.add_window_view(|_, _| Narrow);
|
||||
cx.run_until_parked();
|
||||
let control = cx
|
||||
.debug_bounds("narrow-control")
|
||||
.expect("the control draws");
|
||||
assert_eq!(
|
||||
control.size.width,
|
||||
px(240.),
|
||||
"the field spans the card inside its padding"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user