Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
Cargo.lock
.DS_Store
.idea
Comment thread
rellfy marked this conversation as resolved.
Outdated
19 changes: 19 additions & 0 deletions testing/tests/block_fragments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,22 @@ fn test_fragment_unused_expression() {

assert_eq!(unused_expr.render().unwrap(), "\n\n<p>Required</p>\n");
}

/// Tests rendering a block fragment that inherits a template.
/// Only the block, i.e. the partial content, should be rendered.
#[derive(Template)]
#[template(path = "child.html", block = "content")]
struct Partial<'a> {
title: &'a str
}

#[test]
fn test_partial_render() {
let t = Partial {
title: "the title"
};
assert_eq!(
t.render().unwrap(),
"(the title) Content goes here"
);
}