dioxus/packages/core/tests/safety.rs

18 lines
443 B
Rust
Raw Normal View History

2022-11-22 21:32:26 -08:00
//! Tests related to safety of the library.
2022-11-22 18:38:27 -08:00
use dioxus::prelude::*;
2022-11-22 21:32:26 -08:00
/// Ensure no issues with not calling rebuild
2022-11-22 18:38:27 -08:00
#[test]
fn root_node_isnt_null() {
let dom = VirtualDom::new(|cx| render!("Hello world!"));
let scope = dom.base_scope();
2022-11-22 21:32:26 -08: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-22 18:38:27 -08:00
// The height should be 0
assert_eq!(scope.height(), 0);
}