hydrate.rs 764 B

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