diff --git a/examples/techdemo/src/lib.rs b/examples/techdemo/src/lib.rs
index 0e557cb..09710a5 100644
--- a/examples/techdemo/src/lib.rs
+++ b/examples/techdemo/src/lib.rs
@@ -4,15 +4,22 @@ pub mod ui {}
#[cfg(test)]
mod tests {
use super::ui;
+ use hemplate::Hemplate;
use slhx::{IntoEffect, SafeHtml};
use slhx_test::inspect;
+ #[derive(Hemplate)]
+ #[hemplate = "partials"]
+ struct FastMetric {
+ label: &'static str,
+ }
+
// req: examples/001 req: codegen/002 req: public_api/001
#[test]
fn techdemo_uses_generated_slots_for_multi_target_updates() {
fn update() -> impl IntoEffect {
(
- ui::control_center::slots::hero_metrics.html(SafeHtml::trusted("fast")),
+ ui::control_center::slots::hero_metrics.html(render_fast_metric("fast")),
ui::control_center::slots::notice.text("typed"),
)
}
@@ -22,6 +29,15 @@ mod tests {
assert!(batch.has_slot(ui::control_center::slots::notice));
}
+ fn render_fast_metric(label: &'static str) -> SafeHtml {
+ // req: html_safety/002 req: view/001
+ SafeHtml::trusted(
+ FastMetric { label }
+ .render()
+ .expect("techdemo fast metric renders"),
+ )
+ }
+
// req: examples/001 req: form/002 req: codegen/003
#[test]
fn techdemo_exports_form_and_interaction_handles() {
diff --git a/examples/techdemo/templates/partials/fast_metric.heml b/examples/techdemo/templates/partials/fast_metric.heml
new file mode 100644
index 0000000..80bd5f0
--- /dev/null
+++ b/examples/techdemo/templates/partials/fast_metric.heml
@@ -0,0 +1 @@
+{+ self.label +}