Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
target
Cargo.lock
.DS_Store
.idea

19 changes: 19 additions & 0 deletions testing/tests/block_fragments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,22 @@ fn test_specific_block() {
let t = RenderInPlace { s1 };
assert_eq!(t.render().unwrap(), "\nSection: [abc]\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().trim(),
"(the title) Content goes here"
);
}