more consistent naming of the root component in core

This commit is contained in:
Evan Almloff committed 2024-01-11 15:23:37 -06:00
1 parent 7fe6e05da3
commit 3267ddec10
7 files changed
+31 -31

No files matched your search

+6 -6
View File
@@ -5,7 +5,7 @@ use dioxus_core::ElementId;
/// Should push the text node onto the stack and modify it
#[test]
fn nested_passthru_creates() {
fn App() -> Element {
fn app() -> Element {
render! {
PassThru {
PassThru {
@@ -20,7 +20,7 @@ fn nested_passthru_creates() {
render!(children)
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
assert_eq!(
@@ -37,7 +37,7 @@ fn nested_passthru_creates() {
/// Take note on how we don't spit out the template for child_comp since it's entirely dynamic
#[test]
fn nested_passthru_creates_add() {
fn App() -> Element {
fn app() -> Element {
render! {
ChildComp {
"1"
@@ -57,7 +57,7 @@ fn nested_passthru_creates_add() {
render! {children}
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
assert_eq!(
dom.rebuild_to_vec().santize().edits,
@@ -78,13 +78,13 @@ fn nested_passthru_creates_add() {
/// note that the template is all dynamic roots - so it doesn't actually get cached as a template
#[test]
fn dynamic_node_as_root() {
fn App() -> Element {
fn app() -> Element {
let a = 123;
let b = 456;
render! { "{a}", "{b}" }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
// Since the roots were all dynamic, they should not cause any template muations
+2 -2
View File
@@ -7,7 +7,7 @@ use std::rc::Rc;
#[test]
fn miri_rollover() {
set_event_converter(Box::new(SerializedHtmlEventConverter));
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
@@ -23,7 +23,7 @@ fn miri_rollover() {
}
}
fn App() -> Element {
fn app() -> Element {
let mut idx = use_signal(|| 0);
let onhover = |_| println!("go!");
+10 -10
View File
@@ -2,11 +2,11 @@ use dioxus::prelude::*;
#[test]
fn app_drops() {
fn App() -> Element {
fn app() -> Element {
render! { div {} }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@@ -15,7 +15,7 @@ fn app_drops() {
#[test]
fn hooks_drop() {
fn App() -> Element {
fn app() -> Element {
once(|| String::from("asd"));
once(|| String::from("asd"));
once(|| String::from("asd"));
@@ -24,7 +24,7 @@ fn hooks_drop() {
render! { div {} }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@@ -33,7 +33,7 @@ fn hooks_drop() {
#[test]
fn contexts_drop() {
fn App() -> Element {
fn app() -> Element {
provide_context(String::from("asd"));
render! {
@@ -47,7 +47,7 @@ fn contexts_drop() {
render! { div { "hello {el}" } }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@@ -56,7 +56,7 @@ fn contexts_drop() {
#[test]
fn tasks_drop() {
fn App() -> Element {
fn app() -> Element {
spawn(async {
// tokio::time::sleep(std::time::Duration::from_millis(100000)).await;
});
@@ -64,7 +64,7 @@ fn tasks_drop() {
render! { div {} }
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);
@@ -88,7 +88,7 @@ fn root_props_drop() {
#[test]
fn diffing_drops_old() {
fn App() -> Element {
fn app() -> Element {
render! {
div {
match generation() % 2 {
@@ -110,7 +110,7 @@ fn diffing_drops_old() {
render! {"Goodbye {name}"}
}
let mut dom = VirtualDom::new(App);
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.mark_dirty(ScopeId::ROOT);