wip: add tests and slightly refactor interpreter code

This commit is contained in:
Jonathan Kelley committed 2024-02-23 17:38:04 -08:00
1 parent e0b0afc0a9
commit 53cafefdef
5 files changed
+570 -414

No files matched your search

+13 -4
View File
@@ -4,19 +4,24 @@
//! in the "values" field.
use dioxus::prelude::*;
use std::collections::HashMap;
fn main() {
launch_desktop(app);
launch(app);
}
fn app() -> Element {
let mut values = use_signal(|| HashMap::new());
rsx! {
div {
h1 { "Form" }
form {
onsubmit: move |ev| println!("Submitted {:?}", ev.values()),
oninput: move |ev| println!("Input {:?}", ev.values()),
input { r#type: "text", name: "username" }
oninput: move |ev| values.set(ev.values()),
input {
r#type: "text",
name: "username",
oninput: move |ev| values.set(ev.values())
}
input { r#type: "text", name: "full-name" }
input { r#type: "password", name: "password" }
input { r#type: "radio", name: "color", value: "red" }
@@ -24,5 +29,9 @@ fn app() -> Element {
button { r#type: "submit", value: "Submit", "Submit the form" }
}
}
div {
h1 { "Oninput Values" }
"{values:#?}"
}
}
}