Skip to content

Commit

Permalink
Add a failing test for using include within a block fragment
Browse files Browse the repository at this point in the history
This does not render the include block when used as a fragment,
causing the test to fail. I don't know if this is expected behaviour.
  • Loading branch information
OscartGiles committed Jun 11, 2024
1 parent ab5c6a3 commit 74162b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions testing/templates/fragment-include.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "fragment-base.html" %}

{% block body %}
{% include "included.html" %}
{% endblock %}

{% block other_body %}
<p>Don't render me.</p>
{% endblock %}
12 changes: 12 additions & 0 deletions testing/tests/block_fragments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,15 @@ fn test_specific_block() {
let t = RenderInPlace { s1 };
assert_eq!(t.render().unwrap(), "\nSection: [abc]\n");
}

#[derive(Template)]
#[template(path = "fragment-include.html", block = "body")]
struct FragmentInclude<'a> {
s: &'a str,
}

#[test]
fn test_fragment_include() {
let fragment_include = FragmentInclude { s: "world" };
assert_eq!(fragment_include.render().unwrap(), "\nINCLUDED: world\n");
}

0 comments on commit 74162b9

Please sign in to comment.