test(techdemo): exercise checked form handler path

Add techdemo coverage for #[slhx::form] plus #[slhx::handler] on the generated launch_work form, and ignore the internal __h hidden handle field in generated form metadata.

req: form/001

req: form/004

req: form/006

req: derive_handler/003
This commit is contained in:
slhx agent
2026-05-25 23:57:08 +02:00
parent 54aecff6e8
commit d67478fe36
2 changed files with 32 additions and 1 deletions
+26 -1
View File
@@ -5,7 +5,7 @@ pub mod ui {}
mod tests {
use super::ui;
use hemplate::Hemplate;
use slhx::{IntoEffect, SafeHtml};
use slhx::{Effect, IntoEffect, Payload, SafeHtml};
use slhx_test::inspect;
#[derive(Hemplate)]
@@ -14,6 +14,15 @@ mod tests {
label: &'static str,
}
#[allow(dead_code)]
#[derive(Clone, Debug)]
#[slhx::form("launch_work")]
struct LaunchWork {
title: String,
lane: String,
impact: Option<u8>,
}
// req: examples/001 req: codegen/002 req: public_api/001
#[test]
fn techdemo_uses_generated_slots_for_multi_target_updates() {
@@ -38,6 +47,22 @@ mod tests {
)
}
// req: examples/001 req: form/001 req: form/004 req: form/006 req: derive_handler/003
#[test]
fn techdemo_form_handler_is_checked_against_hemplate_form() {
#[slhx::handler]
fn launch_work(_form: slhx::Form<LaunchWork>) -> impl IntoEffect {
ui::control_center::slots::notice.text("queued")
}
let batch = inspect(launch_work(
ui::control_center::forms::launch_work.typed::<LaunchWork>(),
));
assert!(batch.has_slot(ui::control_center::slots::notice));
assert!(matches!(batch.ops(), [Effect::Put { payload: Payload::Text(_), .. }]));
}
// req: examples/001 req: form/002 req: codegen/003
#[test]
fn techdemo_exports_form_and_interaction_handles() {