2022-11-23 02:38:27 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
use dioxus_core::SuspenseContext;
|
|
|
|
|
|
|
|
/// Ensure no issues with not building the virtualdom before
|
|
|
|
#[test]
|
|
|
|
fn root_node_isnt_null() {
|
|
|
|
let dom = VirtualDom::new(|cx| render!("Hello world!"));
|
|
|
|
|
|
|
|
let scope = dom.base_scope();
|
|
|
|
|
|
|
|
// The root should be a valid pointer
|
|
|
|
assert_ne!(scope.root_node() as *const _, std::ptr::null_mut());
|
|
|
|
|
|
|
|
// The height should be 0
|
|
|
|
assert_eq!(scope.height(), 0);
|
|
|
|
|
|
|
|
// There should be a default suspense context
|
|
|
|
// todo: there should also be a default error boundary
|
|
|
|
assert!(scope.has_context::<SuspenseContext>().is_some());
|
|
|
|
}
|
2022-11-23 03:59:56 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn elements() {
|
|
|
|
let mut dom = VirtualDom::new(|cx| {
|
|
|
|
//
|
|
|
|
cx.render(rsx!( div { "Hello world!" } ))
|
|
|
|
});
|
|
|
|
|
|
|
|
let muts = dom.rebuild();
|
|
|
|
}
|