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
+6
View File
@@ -276,6 +276,10 @@ impl Resources {
component: String,
controls: Vec<GeneratedControl>,
) -> io::Result<()> {
let controls = controls
.into_iter()
.filter(|control| control.name != "__h")
.collect();
let resource = make_resource("form", symbol, name, component, false)?;
match self.forms.get(&resource.ident) {
Some(existing) if existing.resource.symbol != resource.symbol => Err(io::Error::new(
@@ -1062,6 +1066,7 @@ mod tests {
std::fs::write(
templates.join("profile.heml"),
r#"<form data-slhx-handle="save" data-slhx-form="profile">
<input type="hidden" name="__h" value="123">
<input name="title" required>
<input name="count" type="number" min="1" max="10" step="1">
<select name="labels" multiple></select>
@@ -1090,6 +1095,7 @@ mod tests {
let syms = std::fs::read_to_string(out.join("slhx.syms")).unwrap();
assert!(syms.contains("handle_form\tsave\tprofile\n"));
assert!(!syms.contains("form_field\tprofile\t__h\t"));
assert!(syms.contains("form_field\tprofile\ttitle\ttrue\tfalse\n"));
assert!(syms.contains("form_field\tprofile\tlabels\tfalse\ttrue\n"));