feat: upgrade syntax

This commit is contained in:
Jonathan Kelley committed 2021-11-10 17:09:52 -05:00
1 parent 574d7fdb9e
commit fd93ee89c1
64 files changed
+522 -437

No files matched your search

+4 -22
View File
@@ -215,12 +215,12 @@ fn create_components() {
})
};
#[derive(Props)]
struct ChildProps<'a> {
children: ScopeChildren<'a>,
#[derive(Props, PartialEq)]
struct ChildProps {
children: Element,
}
fn Child<'a>(cx: Context<'a>, props: &ChildProps<'a>) -> Element {
fn Child(cx: Context, props: &ChildProps) -> Element {
cx.render(rsx! {
h1 {}
div { {&props.children} }
@@ -299,21 +299,3 @@ fn anchors() {
]
);
}
#[test]
fn suspended() {
todo!()
// static App: FC<()> = |cx, props| {
// let val = use_suspense(cx, || async {}, |p| todo!());
// cx.render(rsx! { {val} })
// };
// let mut dom = new_dom(App, ());
// let mutations = dom.rebuild();
// assert_eq!(
// mutations.edits,
// [CreatePlaceholder { root: 0 }, AppendChildren { many: 1 },]
// );
}
+3 -22
View File
@@ -257,12 +257,12 @@ fn many_items_become_fragment() {
]
);
// hmmmmmmmmm worried about reusing IDs that we shouldnt be
// note: the ID gets reused
assert_eq!(
change.edits,
[
Remove { root: 2 },
CreatePlaceholder { root: 4 },
CreatePlaceholder { root: 3 },
ReplaceWith { root: 0, m: 1 },
]
);
@@ -433,7 +433,7 @@ fn keyed_diffing_order() {
let dom = new_dom();
let left = rsx!(
// {(0..5).map(|f| {rsx! { div { key: "{f}" }}})}
{(0..5).map(|f| {rsx! { div { key: "{f}" }}})}
p {"e"}
);
let right = rsx!(
@@ -802,22 +802,3 @@ fn controlled_keyed_diffing_out_of_order_max_test() {
]
);
}
#[test]
fn suspense() {
let dom = new_dom();
todo!()
// let edits = dom.create_vnodes(Some(LazyNodes::new(|f| {
// use std::cell::{Cell, RefCell};
// VNode::Suspended(f.bump().alloc(VSuspended {
// task_id: 0,
// callback: RefCell::new(None),
// dom_id: Cell::new(None),
// }))
// })));
// assert_eq!(
// edits.edits,
// [CreatePlaceholder { root: 0 }, AppendChildren { many: 1 }]
// );
}