From 19a706b8a60bf530e1a61ab948b3639ad91a29fc Mon Sep 17 00:00:00 2001 From: myypo Date: Sat, 26 Sep 2026 18:56:56 +0300 Subject: [PATCH] feat: add command html attribute --- crates/cheers/src/validation/elements.rs | 6 ++++++ crates/cheers/tests/main.rs | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/crates/cheers/src/validation/elements.rs b/crates/cheers/src/validation/elements.rs index f1dc3a1..e6fb482 100644 --- a/crates/cheers/src/validation/elements.rs +++ b/crates/cheers/src/validation/elements.rs @@ -550,6 +550,12 @@ define_validation_elements! { /// A button labeled by its contents. button { + /// Action to perform on the element targeted by `commandfor` + command + + /// ID of the element controlled by the button + commandfor + /// Whether the form control is disabled disabled diff --git a/crates/cheers/tests/main.rs b/crates/cheers/tests/main.rs index acc68c4..9caeb63 100644 --- a/crates/cheers/tests/main.rs +++ b/crates/cheers/tests/main.rs @@ -876,6 +876,20 @@ fn aria_multiple_attributes() { ); } +#[test] +fn button_command_attributes() { + let result = html! { + button command="show-modal" commandfor="dialog" { "Open" } + dialog id="dialog" {} + } + .render(); + + assert_eq!( + result.as_inner(), + r#""# + ); +} + #[test] #[cfg(feature = "mathml")] fn mathml() {