1
0

safety.rs 461 B

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