dioxus/packages/core/tests/create_element.rs

30 lines
794 B
Rust
Raw Normal View History

2022-11-27 07:06:04 +00:00
use dioxus::core::Mutation::*;
use dioxus::prelude::*;
#[test]
fn multiroot() {
let mut dom = VirtualDom::new(|cx| {
cx.render(rsx! {
div { "Hello a" }
div { "Hello b" }
div { "Hello c" }
})
});
assert_eq!(
2022-12-01 04:54:30 +00:00
dom.rebuild().santize().template_edits,
2022-11-27 07:06:04 +00:00
[
CreateElement { name: "div" },
CreateStaticText { value: "Hello a" },
AppendChildren { m: 1 },
CreateElement { name: "div" },
CreateStaticText { value: "Hello b" },
AppendChildren { m: 1 },
CreateElement { name: "div" },
CreateStaticText { value: "Hello c" },
AppendChildren { m: 1 },
SaveTemplate { name: "template", m: 3 }
]
)
}