wip: remove cx.children. start to move towards a "children" field

This commit is contained in:
Jonathan Kelley committed 2021-11-01 02:22:08 -04:00
1 parent 6b2645fd80
commit 7b97e009ec
14 files changed
+114 -276

No files matched your search

+30 -16
View File
@@ -22,13 +22,13 @@ fn new_dom<P: 'static + Send>(app: FC<P>, props: P) -> VirtualDom {
#[test]
fn test_original_diff() {
static APP: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
div {
div {
"Hello, world!"
}
}
}
})
};
let mut dom = new_dom(APP, ());
@@ -58,7 +58,7 @@ fn test_original_diff() {
#[test]
fn create() {
static APP: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
div {
div {
"Hello, world!"
@@ -72,7 +72,7 @@ fn create() {
}
}
}
}
})
};
let mut dom = new_dom(APP, ());
@@ -121,11 +121,11 @@ fn create() {
#[test]
fn create_list() {
static APP: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
{(0..3).map(|f| rsx!{ div {
"hello"
}})}
}
})
};
let mut dom = new_dom(APP, ());
@@ -170,12 +170,12 @@ fn create_list() {
#[test]
fn create_simple() {
static APP: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
div {}
div {}
div {}
div {}
}
})
};
let mut dom = new_dom(APP, ());
@@ -208,19 +208,19 @@ fn create_simple() {
#[test]
fn create_components() {
static App: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
Child { "abc1" }
Child { "abc2" }
Child { "abc3" }
}
})
};
static Child: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
h1 {}
div { {cx.children()} }
p {}
}
})
};
let mut dom = new_dom(App, ());
@@ -269,10 +269,10 @@ fn create_components() {
#[test]
fn anchors() {
static App: FC<()> = |(cx, props)| {
rsx! {
cx.render(rsx! {
{true.then(|| rsx!{ div { "hello" } })}
{false.then(|| rsx!{ div { "goodbye" } })}
}
})
};
let mut dom = new_dom(App, ());
@@ -303,9 +303,23 @@ fn suspended() {
|| async {
//
},
|cx, p| rsx! { "hi "},
|cx, p| todo!(),
// |cx, p| rsx! { "hi "},
);
rsx! { {val} }
// let prom = use_task(fetch());
// Value {
// a: value.await,
// b: value.await,
// f: a.await
// div {
// div {
// hidden: should_hide.await,
// }
// }
// }
cx.render(rsx! { {val} })
};
let mut dom = new_dom(App, ());