Skip to content

Commit

Permalink
add test to document different behavior in partials
Browse files Browse the repository at this point in the history
  • Loading branch information
cmrschwarz committed Jul 13, 2024
1 parent 4499fd1 commit cc6ad7e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/whitespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,27 @@ fn tag_before_eof_becomes_standalone_in_full_template() {
output
);
}

#[test]
fn tag_before_eof_does_not_become_standalone_in_partial() {
let input = r#"{{#*inline "partial"}}
<ul>
{{#each a}}
<li>{{this}}</li>
{{/each}}{{/inline}}
{{> partial}}"#;

let output = r#"
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
"#;
let hbs = Handlebars::new();

assert_eq!(
hbs.render_template(input, &json!({"a": [1, 2, 3]}))
.unwrap(),
output
);
}

0 comments on commit cc6ad7e

Please sign in to comment.