(pagetop): Añade Flex/FlexItem para usar Flexbox

Container y Navbar lo adoptan vía `with_flex()`/`PropsOp::flex_item()`.
Y se elimina `ButtonSet` porque su funcionalidad queda cubierta por este
mecanismo más general. Incluye el ejemplo `examples/intro-flex.rs` con
los patrones de uso.
This commit is contained in:
Manuel Cillero 2026-09-04 01:04:53 +02:00
parent 4e4fdf7b10
commit 17e16652e4
26 changed files with 2023 additions and 193 deletions

View file

@ -142,58 +142,3 @@ async fn disabled_anchor_omits_href_and_sets_aria_disabled() {
assert!(html.contains(r#"aria-disabled="true""#));
assert!(html.contains(r#"tabindex="-1""#));
}
// **< ButtonSet >**********************************************************************************
#[pagetop::test]
async fn button_set_is_not_rendered_when_empty() {
let mut set = button::ButtonSet::new();
let html = set.render(&mut Context::default()).await;
assert!(html.is_empty());
}
#[pagetop::test]
async fn button_set_wraps_buttons_in_button_set_class() {
let mut set = button::ButtonSet::new().with_button(Button::submit(Lc::n("Save")));
let html = set.render(&mut Context::default()).await.into_string();
assert!(html.contains("button-set"));
assert!(html.contains("Save"));
}
#[pagetop::test]
async fn button_set_renders_buttons_in_insertion_order() {
let mut set = button::ButtonSet::new()
.with_button(Button::submit(Lc::n("First")))
.with_button(Button::plain(Lc::n("Second")));
let html = set.render(&mut Context::default()).await.into_string();
assert!(html.find("First").unwrap() < html.find("Second").unwrap());
}
#[pagetop::test]
async fn button_set_add_many_appends_all_buttons() {
let mut set = button::ButtonSet::new().with_button(TypedOp::AddMany(vec![
Button::submit(Lc::n("Save")),
Button::reset(Lc::n("Reset")),
Button::plain(Lc::n("Cancel")),
]));
let html = set.render(&mut Context::default()).await.into_string();
assert!(html.contains("Save"));
assert!(html.contains("Reset"));
assert!(html.contains("Cancel"));
}
#[pagetop::test]
async fn button_set_remove_by_id_drops_matching_button() {
let mut set = button::ButtonSet::new()
.with_button(Button::submit(Lc::n("Save")).with_id("save-button"))
.with_button(Button::plain(Lc::n("Cancel")))
.with_button(TypedOp::RemoveById("save-button"));
let html = set.render(&mut Context::default()).await.into_string();
assert!(!html.contains("Save"));
assert!(html.contains("Cancel"));
}