Merge pull request #1324 from ealmloff/bool-attrs-ssr

Fix boolean attribute rendering in SSR
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2023-09-16 12:01:52 -07:00
commit 9c300ff266
6 files changed
+139 -26

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
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>"#
);
}