safety.rs 443 B

1234567891011121314151617
  1. //! Tests related to safety of the library.
  2. use dioxus::prelude::*;
  3. /// Ensure no issues with not calling rebuild
  4. #[test]
  5. fn root_node_isnt_null() {
  6. let dom = VirtualDom::new(|cx| render!("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. // The height should be 0
  11. assert_eq!(scope.height(), 0);
  12. }