mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-19 17:13:12 +00:00
38 lines
729 B
Rust
38 lines
729 B
Rust
|
use dioxus::prelude::*;
|
||
|
|
||
|
#[test]
|
||
|
fn static_boolean_attributs() {
|
||
|
fn app(cx: Scope) -> Element {
|
||
|
render! {
|
||
|
div { hidden: "false" }
|
||
|
div { hidden: "true" }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let mut dom = VirtualDom::new(app);
|
||
|
_ = dom.rebuild();
|
||
|
|
||
|
assert_eq!(
|
||
|
dioxus_ssr::render(&dom),
|
||
|
r#"<div></div><div hidden="true"></div>"#
|
||
|
);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn dynamic_boolean_attributs() {
|
||
|
fn app(cx: Scope) -> Element {
|
||
|
render! {
|
||
|
div { hidden: false }
|
||
|
div { hidden: true }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let mut dom = VirtualDom::new(app);
|
||
|
_ = dom.rebuild();
|
||
|
|
||
|
assert_eq!(
|
||
|
dioxus_ssr::render(&dom),
|
||
|
r#"<div></div><div hidden=true></div>"#
|
||
|
);
|
||
|
}
|