test(kanban): render lib slot from view helper

Use RenderSlotExt in the kanban library smoke test so even the small public example test path avoids explicit SafeHtml/html plumbing.

req: view/001

req: html_safety/002
This commit is contained in:
slhx agent
2026-05-26 01:07:06 +02:00
parent 5845930cd3
commit 3d65e92783
+4 -8
View File
@@ -6,7 +6,7 @@ mod tests {
use super::ui;
use hemplate::Hemplate;
use scraper::{Html, Selector};
use slhx::{Effect, IntoEffect, Payload, SafeHtml};
use slhx::{Effect, IntoEffect, Payload, RenderSlotExt};
use slhx_test::inspect;
#[derive(Hemplate)]
@@ -27,7 +27,7 @@ mod tests {
#[test]
fn kanban_board_updates_generated_slot() {
fn render_board() -> impl IntoEffect {
ui::board::slots::board.html(render_empty_board())
ui::board::slots::board.render_view(&empty_board())
}
let effect = inspect(render_board());
@@ -38,18 +38,14 @@ mod tests {
// req: html_safety/002 req: view/001 req: test/005
#[test]
fn kanban_board_test_payload_is_rendered_by_a_hemplate_view() {
let html = render_empty_board();
let html = slhx::render_html(&empty_board());
let document = Html::parse_fragment(html.as_str());
assert_eq!(document.select(&selector(".columns")).count(), 1);
}
fn render_empty_board() -> SafeHtml {
fn empty_board() -> BoardColumns {
// req: html_safety/002 req: view/001
let mut html = String::new();
BoardColumns { columns: Vec::new() }
.render_into(&mut html)
.expect("kanban board test view renders");
SafeHtml::trusted(html)
}
fn selector(value: &str) -> Selector {