Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a failing test for using include within a block fragment #1066

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
Loading