✨ (base): Oculta separadores en menús sin opciones
`Dropdown::items()` devuelve `dropdown::Items`, cuyo `render()` sólo pinta un encabezado si su grupo tiene algún elemento visible, y un separador sólo entre elementos visibles. Lo aprovecha cualquier tema que pinte el menú con `items().render()`.
This commit is contained in:
parent
e2e2ccb31e
commit
c940403869
9 changed files with 292 additions and 10 deletions
|
|
@ -68,6 +68,15 @@ async fn child_id_returns_component_id() {
|
|||
assert_eq!(child.id(), Some("my-id".to_string()));
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
async fn child_downcast_ref_returns_the_component_only_with_its_type() {
|
||||
let child = Child::with(TestComp::text("hello"));
|
||||
let component = child.downcast_ref::<TestComp>().expect("a TestComp");
|
||||
assert_eq!(component.text, "hello");
|
||||
assert!(child.downcast_ref::<Html>().is_none());
|
||||
assert!(Child::default().downcast_ref::<TestComp>().is_none());
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
async fn child_from_component_is_equivalent_to_with() {
|
||||
let child: Child = TestComp::text("from-trait").into();
|
||||
|
|
@ -257,6 +266,19 @@ async fn children_iter_by_id_yields_all_matching_children() {
|
|||
assert_eq!(c.iter_by_id("none").count(), 0);
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
async fn children_iter_yields_all_children_in_order() {
|
||||
let c = Children::new()
|
||||
.with_child(TestComp::text("a"))
|
||||
.with_child(TestComp::text("b"));
|
||||
let texts: Vec<&str> = c
|
||||
.iter()
|
||||
.filter_map(|child| child.downcast_ref::<TestComp>())
|
||||
.map(|component| component.text.as_str())
|
||||
.collect();
|
||||
assert_eq!(texts, ["a", "b"]);
|
||||
}
|
||||
|
||||
#[pagetop::test]
|
||||
async fn children_render_concatenates_all_outputs_in_order() {
|
||||
let c = Children::new()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue