2022-03-02 22:57:57 +00:00
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
2022-06-25 13:27:10 +00:00
|
|
|
use dioxus::prelude::*;
|
2022-03-02 22:57:57 +00:00
|
|
|
use dioxus_router::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn generates_without_error() {
|
|
|
|
let mut app = VirtualDom::new(app);
|
|
|
|
app.rebuild();
|
|
|
|
|
|
|
|
let out = dioxus_ssr::render_vdom(&app);
|
|
|
|
|
2022-03-03 04:03:10 +00:00
|
|
|
assert_eq!(out, "<nav>navbar</nav>default<!--placeholder-->");
|
2022-03-02 22:57:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn app(cx: Scope) -> Element {
|
|
|
|
cx.render(rsx! {
|
|
|
|
Router {
|
|
|
|
nav { "navbar" }
|
2022-03-03 04:03:10 +00:00
|
|
|
Route { to: "/", "default" }
|
2022-03-02 22:57:57 +00:00
|
|
|
Route { to: "/home", Home {} }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn Home(cx: Scope) -> Element {
|
|
|
|
cx.render(rsx! { h1 { "Home" } })
|
|
|
|
}
|