work on fixing some core tests

This commit is contained in:
Evan Almloff committed 2024-01-10 19:21:15 -06:00
1 parent 4a1a00b0f0
commit 55f76fede6
35 files changed
+422 -460

No files matched your search

+15 -13
View File
@@ -6,32 +6,34 @@ fn basic_syntax_is_a_template(cx: Scope) -> Element {
let asd = 123;
let var = 123;
cx.render(rsx! {
div { key: "12345",
class: "asd",
class: "{asd}",
class: if true { "{asd}" },
class: if false { "{asd}" },
onclick: move |_| {},
render! {
div { key: "12345", class: "asd", class: "{asd}", class: if true {
"{asd}"
}, class: if false {
"{asd}"
}, onclick: move |_| {},
div { "{var}" }
div {
h1 { "var" }
p { "you're great!" }
div { background_color: "red",
h1 { "var" }
div { b { "asd" } "not great" }
div {
b { "asd" }
"not great"
}
}
p { "you're great!" }
}
}
})
}
}
#[test]
fn dual_stream() {
let mut dom = VirtualDom::new(basic_syntax_is_a_template);
let bump = Bump::new();
let edits = dom.rebuild().santize();
let edits = dom.rebuild_to_vec().santize();
use Mutation::*;
assert_eq!(edits.edits, {
@@ -39,12 +41,12 @@ fn dual_stream() {
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
SetAttribute {
name: "class",
value: (&*bump.alloc("asd 123 123".into_value(&bump))).into(),
value: "asd 123 123".into_value(),
id: ElementId(1),
ns: None,
},
NewEventListener { name: "click", id: ElementId(1) },
HydrateText { path: &[0, 0], value: "123", id: ElementId(2) },
NewEventListener { name: "click".to_string(), id: ElementId(1) },
HydrateText { path: &[0, 0], value: "123".to_string(), id: ElementId(2) },
AppendChildren { id: ElementId(0), m: 1 },
]
});