diff --git a/.gitignore b/.gitignore index 22d9b57e..2f503d44 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ target Cargo.lock .DS_Store +.idea + diff --git a/testing/tests/block_fragments.rs b/testing/tests/block_fragments.rs index ae723b6d..c9e8d0c4 100644 --- a/testing/tests/block_fragments.rs +++ b/testing/tests/block_fragments.rs @@ -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" + ); +}