diff_iterative.rs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //! tests to prove that the iterative implementation works
  2. use dioxus::prelude::*;
  3. mod test_logging;
  4. use dioxus_core as dioxus;
  5. use dioxus_html as dioxus_elements;
  6. #[async_std::test]
  7. async fn test_iterative_create_components() {
  8. static App: FC<()> = |cx| {
  9. // test root fragments
  10. cx.render(rsx! {
  11. Child { "abc1" }
  12. Child { "abc2" }
  13. Child { "abc3" }
  14. })
  15. };
  16. fn Child(cx: Context<()>) -> DomTree {
  17. // test root fragments, anchors, and ChildNode type
  18. cx.render(rsx! {
  19. h1 {}
  20. div { {cx.children()} }
  21. Fragment {
  22. Fragment {
  23. Fragment {
  24. "wozza"
  25. }
  26. }
  27. }
  28. {(0..0).map(|f| rsx!{ div { "walalla"}})}
  29. p {}
  30. })
  31. }
  32. test_logging::set_up_logging();
  33. let mut dom = VirtualDom::new(App);
  34. let mutations = dom.rebuild_async().await.unwrap();
  35. dbg!(mutations);
  36. let mutations = dom.diff_async().await.unwrap();
  37. dbg!(mutations);
  38. }