work on fixing some core tests
This commit is contained in:
1 parent
4a1a00b0f0
commit
55f76fede6
35 files changed
+422
-460
No files matched your search
@@ -4,16 +4,14 @@ use dioxus::prelude::*;
|
||||
/// As we clean up old templates, the ID for the node should cycle
|
||||
#[test]
|
||||
fn cycling_elements() {
|
||||
let mut dom = VirtualDom::new(|cx| {
|
||||
cx.render(match cx.generation() % 2 {
|
||||
0 => rsx! { div { "wasd" } },
|
||||
1 => rsx! { div { "abcd" } },
|
||||
_ => unreachable!(),
|
||||
})
|
||||
let mut dom = VirtualDom::new(|cx| match generation() % 2 {
|
||||
0 => render! { div { "wasd" } },
|
||||
1 => render! { div { "abcd" } },
|
||||
_ => unreachable!(),
|
||||
});
|
||||
|
||||
{
|
||||
let edits = dom.rebuild().santize();
|
||||
let edits = dom.rebuild_to_vec().santize();
|
||||
assert_eq!(
|
||||
edits.edits,
|
||||
[
|
||||
@@ -25,7 +23,7 @@ fn cycling_elements() {
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
dom.render_immediate().santize().edits,
|
||||
dom.render_immediate_to_vec().santize().edits,
|
||||
[
|
||||
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
|
||||
ReplaceWith { id: ElementId(1,), m: 1 },
|
||||
@@ -35,7 +33,7 @@ fn cycling_elements() {
|
||||
// notice that the IDs cycle back to ElementId(1), preserving a minimal memory footprint
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
dom.render_immediate().santize().edits,
|
||||
dom.render_immediate_to_vec().santize().edits,
|
||||
[
|
||||
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
|
||||
ReplaceWith { id: ElementId(2,), m: 1 },
|
||||
@@ -44,7 +42,7 @@ fn cycling_elements() {
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
dom.render_immediate().santize().edits,
|
||||
dom.render_immediate_to_vec().santize().edits,
|
||||
[
|
||||
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
|
||||
ReplaceWith { id: ElementId(1,), m: 1 },
|
||||
|
||||
Reference in new issue
Block a user