1
0

safety.rs 493 B

12345678910111213141516171819
  1. //! Tests related to safety of the library.
  2. use dioxus::prelude::*;
  3. /// Ensure no issues with not calling rebuild_to_vec
  4. #[test]
  5. fn root_node_isnt_null() {
  6. let dom = VirtualDom::new(|| rsx!("Hello world!"));
  7. let scope = dom.base_scope();
  8. // We haven't built the tree, so trying to get out the root node should fail
  9. assert!(scope.try_root_node().is_none());
  10. dom.in_runtime(|| {
  11. // The height should be 0
  12. assert_eq!(ScopeId::ROOT.height(), 0);
  13. });
  14. }