dioxus/packages/core/tests/safety.rs

18 lines
443 B
Rust
Raw Normal View History

2022-11-23 05:32:26 +00:00
//! Tests related to safety of the library.
2022-11-23 02:38:27 +00:00
use dioxus::prelude::*;
2022-11-23 05:32:26 +00:00
/// Ensure no issues with not calling rebuild
2022-11-23 02:38:27 +00:00
#[test]
fn root_node_isnt_null() {
let dom = VirtualDom::new(|cx| render!("Hello world!"));
let scope = dom.base_scope();
2022-11-23 05:32:26 +00:00
// We haven't built the tree, so trying to get out the root node should fail
assert!(scope.try_root_node().is_none());
2022-11-23 02:38:27 +00:00
// The height should be 0
assert_eq!(scope.height(), 0);
}