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
@@ -7,24 +7,22 @@ use dioxus_core::ElementId;
|
||||
fn nested_passthru_creates() {
|
||||
#[component]
|
||||
fn App(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
render! {
|
||||
PassThru {
|
||||
PassThru {
|
||||
PassThru {
|
||||
div { "hi" }
|
||||
}
|
||||
PassThru { div { "hi" } }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn PassThru<'a>(cx: Scope<'a>, children: Element) -> Element {
|
||||
cx.render(rsx!(children))
|
||||
render!(children)
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(App);
|
||||
let edits = dom.rebuild().santize();
|
||||
let edits = dom.rebuild_to_vec().santize();
|
||||
|
||||
assert_eq!(
|
||||
edits.edits,
|
||||
@@ -42,31 +40,29 @@ fn nested_passthru_creates() {
|
||||
fn nested_passthru_creates_add() {
|
||||
#[component]
|
||||
fn App(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
render! {
|
||||
ChildComp {
|
||||
"1"
|
||||
ChildComp {
|
||||
"2"
|
||||
ChildComp {
|
||||
"3"
|
||||
div {
|
||||
"hi"
|
||||
}
|
||||
div { "hi" }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn ChildComp<'a>(cx: Scope, children: Element) -> Element {
|
||||
cx.render(rsx! { children })
|
||||
render! {children}
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(App);
|
||||
|
||||
assert_eq!(
|
||||
dom.rebuild().santize().edits,
|
||||
dom.rebuild_to_vec().santize().edits,
|
||||
[
|
||||
// load 1
|
||||
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
|
||||
@@ -88,11 +84,11 @@ fn dynamic_node_as_root() {
|
||||
fn App(cx: Scope) -> Element {
|
||||
let a = 123;
|
||||
let b = 456;
|
||||
cx.render(rsx! { "{a}" "{b}" })
|
||||
render! { "{a}", "{b}" }
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(App);
|
||||
let edits = dom.rebuild().santize();
|
||||
let edits = dom.rebuild_to_vec().santize();
|
||||
|
||||
// Since the roots were all dynamic, they should not cause any template muations
|
||||
assert!(edits.templates.is_empty());
|
||||
@@ -101,8 +97,8 @@ fn dynamic_node_as_root() {
|
||||
assert_eq!(
|
||||
edits.edits,
|
||||
[
|
||||
CreateTextNode { value: "123", id: ElementId(1) },
|
||||
CreateTextNode { value: "456", id: ElementId(2) },
|
||||
CreateTextNode { value: "123".to_string(), id: ElementId(1) },
|
||||
CreateTextNode { value: "456".to_string(), id: ElementId(2) },
|
||||
AppendChildren { id: ElementId(0), m: 2 }
|
||||
]
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user