mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 20:53:06 +00:00
28 lines
563 B
Rust
28 lines
563 B
Rust
#![allow(non_snake_case)]
|
|
|
|
use dioxus::prelude::*;
|
|
use dioxus_router::*;
|
|
|
|
#[test]
|
|
fn generates_without_error() {
|
|
let mut app = VirtualDom::new(app);
|
|
app.rebuild();
|
|
|
|
let out = dioxus_ssr::render_vdom(&app);
|
|
|
|
assert_eq!(out, "<nav>navbar</nav>default<!--placeholder-->");
|
|
}
|
|
|
|
fn app(cx: Scope) -> Element {
|
|
cx.render(rsx! {
|
|
Router {
|
|
nav { "navbar" }
|
|
Route { to: "/", "default" }
|
|
Route { to: "/home", Home {} }
|
|
}
|
|
})
|
|
}
|
|
|
|
fn Home(cx: Scope) -> Element {
|
|
cx.render(rsx! { h1 { "Home" } })
|
|
}
|