hydrate.rs 791 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. use dioxus_core as dioxus;
  2. use dioxus_core::prelude::*;
  3. use dioxus_core_macro::*;
  4. use dioxus_html as dioxus_elements;
  5. use wasm_bindgen_test::wasm_bindgen_test;
  6. wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
  7. #[test]
  8. fn makes_tree() {
  9. fn app(cx: Scope) -> Element {
  10. cx.render(rsx! {
  11. div {
  12. h1 {}
  13. }
  14. div {
  15. h2 {}
  16. }
  17. })
  18. }
  19. let mut dom = VirtualDom::new(app);
  20. let muts = dom.rebuild();
  21. dbg!(muts.edits);
  22. }
  23. #[wasm_bindgen_test]
  24. fn rehydrates() {
  25. fn app(cx: Scope) -> Element {
  26. cx.render(rsx! {
  27. div {
  28. h1 {}
  29. }
  30. div {
  31. h2 {}
  32. }
  33. })
  34. }
  35. dioxus_web::launch(app);
  36. }