dioxus/tests/fermi.rs

47 lines
860 B
Rust
Raw Normal View History

2022-02-17 15:38:51 +00:00
#![allow(non_snake_case)]
use dioxus::prelude::*;
use fermi::*;
#[test]
fn test_fermi() {
let mut app = VirtualDom::new(App);
app.rebuild();
}
static TITLE: Atom<String> = |_| "".to_string();
static USERS: AtomFamily<u32, String> = |_| Default::default();
fn App(cx: Scope) -> Element {
cx.render(rsx!(
Leaf { id: 0 }
Leaf { id: 1 }
Leaf { id: 2 }
))
}
#[derive(Debug, PartialEq, Props)]
struct LeafProps {
id: u32,
}
fn Leaf(cx: Scope<LeafProps>) -> Element {
2022-02-17 15:43:34 +00:00
let _user = use_read(&cx, TITLE);
let _user = use_read(&cx, USERS);
2022-02-17 15:38:51 +00:00
rsx!(cx, div {
button {
onclick: move |_| {},
"Start"
}
button {
onclick: move |_| {},
"Stop"
}
button {
onclick: move |_| {},
"Reverse"
}
})
}