Misc · Terms and notices: tests for every way out; switch labels wrap
Tests now press Decline and the scrim, see focus return to the opener after Accept, see necessary cookies stay on and off the Tab path, and see the license list mark its row and read each version and license. lists::ListItem marks its description and selected state for tests. forms::Switch's label wraps in its own block, as Checkbox's does. Ely's own row in the gallery shows both of its license texts.
This commit is contained in:
1 parent
2837c802b5
commit
8794a42d42
7 files changed
+123
-24
No files matched your search
+7
-1
@@ -140,6 +140,12 @@ impl RenderOnce for Switch {
|
||||
})
|
||||
})
|
||||
.child(rail)
|
||||
.children(self.label)
|
||||
.children(self.label.map(|label| {
|
||||
div()
|
||||
.debug_selector(|| "switch-label".into())
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.child(label)
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ use gpui::{
|
||||
|
||||
use super::setup;
|
||||
use crate::{
|
||||
forms::{Checkbox, Choice, IconPicker, InlineEdit, RadioGroup, SignaturePad, Stroke},
|
||||
forms::{Checkbox, Choice, IconPicker, InlineEdit, RadioGroup, SignaturePad, Stroke, Switch},
|
||||
primitives::{FocusNext, IconName},
|
||||
};
|
||||
|
||||
@@ -145,7 +145,7 @@ fn an_inline_edit_takes_tab_opens_on_enter_and_takes_focus_back(cx: &mut TestApp
|
||||
);
|
||||
}
|
||||
|
||||
/// A checkbox and a radio whose labels run past their narrow box.
|
||||
/// A checkbox, a radio and a switch whose labels run past their narrow box.
|
||||
struct Worded;
|
||||
|
||||
impl Render for Worded {
|
||||
@@ -158,6 +158,7 @@ impl Render for Worded {
|
||||
"worded-radios",
|
||||
[Choice::new("one", label)],
|
||||
))
|
||||
.child(Switch::new("worded-switch", false).label(label))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ fn long_labels_wrap_inside_their_box(cx: &mut TestAppContext) {
|
||||
setup(cx);
|
||||
let (_, cx) = cx.add_window_view(|_, _| Worded);
|
||||
cx.run_until_parked();
|
||||
for selector in ["checkbox-label", "radio-label"] {
|
||||
for selector in ["checkbox-label", "radio-label", "switch-label"] {
|
||||
let label = cx.debug_bounds(selector).expect("the label draws");
|
||||
assert!(label.right() <= px(200.0), "{selector}: {label:?}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user