fix boolean attribute rendering in SSR
This commit is contained in:
1 parent
a025617db3
commit
aaded7981f
3 files changed
+122
-22
No files matched your search
@@ -0,0 +1,38 @@
|
||||
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 {
|
||||
let inner_html = "<div>1234</div>";
|
||||
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>"#
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user