2023-08-08 17:56:41 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn static_boolean_attributs() {
|
2024-01-10 23:57:15 +00:00
|
|
|
fn app(_: ()) -> Element {
|
2023-08-08 17:56:41 +00:00
|
|
|
render! {
|
|
|
|
div { hidden: "false" }
|
|
|
|
div { hidden: "true" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let mut dom = VirtualDom::new(app);
|
2024-01-10 23:57:15 +00:00
|
|
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
2023-08-08 17:56:41 +00:00
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
dioxus_ssr::render(&dom),
|
|
|
|
r#"<div></div><div hidden="true"></div>"#
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dynamic_boolean_attributs() {
|
2024-01-10 23:57:15 +00:00
|
|
|
fn app(_: ()) -> Element {
|
2023-08-08 17:56:41 +00:00
|
|
|
render! {
|
|
|
|
div { hidden: false }
|
|
|
|
div { hidden: true }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let mut dom = VirtualDom::new(app);
|
2024-01-10 23:57:15 +00:00
|
|
|
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
2023-08-08 17:56:41 +00:00
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
dioxus_ssr::render(&dom),
|
|
|
|
r#"<div></div><div hidden=true></div>"#
|
|
|
|
);
|
|
|
|
}
|