test(examples): render hemplate views into buffers

Use hemplate render_into in public examples and example tests instead of the string-returning render helper, preserving SafeHtml wrapping only at the explicit effect boundary.

req: view/001

req: html_safety/002
This commit is contained in:
slhx agent
2026-05-26 00:46:13 +02:00
parent b2aa1760c5
commit 62316d5f1e
6 changed files with 35 additions and 23 deletions
+10 -10
View File
@@ -88,11 +88,11 @@ mod tests {
fn render_todo_row(todo: &Todo) -> SafeHtml {
// req: html_safety/002 req: view/001
SafeHtml::trusted(
TodoRow { title: todo.title.clone() }
.render()
.expect("v0 todo row renders"),
)
let mut html = String::new();
TodoRow { title: todo.title.clone() }
.render_into(&mut html)
.expect("v0 todo row renders");
SafeHtml::trusted(html)
}
// req: examples/001 req: form/001 req: form/004 req: form/006 req: derive_handler/003
@@ -143,11 +143,11 @@ mod tests {
fn render_docs_content(message: &'static str) -> SafeHtml {
// req: html_safety/002 req: view/001
SafeHtml::trusted(
DocsContent { message }
.render()
.expect("v0 docs content renders"),
)
let mut html = String::new();
DocsContent { message }
.render_into(&mut html)
.expect("v0 docs content renders");
SafeHtml::trusted(html)
}
// req: examples/001 req: form/001 req: form/004 req: form/006 req: derive_handler/003