From 1aa92d8d9d3789aa8383f30c4d6724e80b07828a Mon Sep 17 00:00:00 2001 From: slhx agent Date: Mon, 22 Jun 2026 22:17:21 +0200 Subject: [PATCH] feat(examples): expose v0 todo field error targets Add generated field-error targets to the v0 add and rename forms so the canonical todo example shows recoverable typed form feedback end to end instead of emitting errors with no visible target. req: examples/001 req: canonical_authoring/003 --- examples/v0/src/main.rs | 9 ++++++++- examples/v0/templates/partials/todo_row.heml | 1 + examples/v0/templates/todos.heml | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/v0/src/main.rs b/examples/v0/src/main.rs index 5b0301b..1938f82 100644 --- a/examples/v0/src/main.rs +++ b/examples/v0/src/main.rs @@ -133,7 +133,7 @@ impl Hemplate for Todos { fn render_into(&self, buf: &mut String) -> Result<(), hemplate::error::HemplateError> { use std::fmt::Write as _; - buf.push_str("
\n
\n \n \n

\n
\n\n

"); + buf.push_str("

\n
\n \n \n

\n
\n\n

"); write!(buf, "{}", hemplate::HtmlEscape(&self.summary))?; buf.push_str("

\n

"); write!(buf, "{}", hemplate::HtmlEscape(&self.notice))?; @@ -620,6 +620,13 @@ mod tests { .select(&selector(&escaped_markup_selector("b"))) .next() .is_none()); + assert_eq!( + document + .select(&selector("[data-hemx-error-for='title']")) + .count(), + 2, + "add and rename forms expose generated field-error targets" + ); } // req: canonical_authoring/003 req: test/005 diff --git a/examples/v0/templates/partials/todo_row.heml b/examples/v0/templates/partials/todo_row.heml index 1d73acb..ad7ecfe 100644 --- a/examples/v0/templates/partials/todo_row.heml +++ b/examples/v0/templates/partials/todo_row.heml @@ -7,6 +7,7 @@ +

diff --git a/examples/v0/templates/todos.heml b/examples/v0/templates/todos.heml index ed44c80..a66ea91 100644 --- a/examples/v0/templates/todos.heml +++ b/examples/v0/templates/todos.heml @@ -2,6 +2,7 @@ +

{+ self.summary +}

{+ self.notice +}