Skip to content

Commit 392cc5c

Browse files
committed
Add issue test
1 parent e709aa9 commit 392cc5c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

source/Handlebars.Test/IssueTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,23 @@ End outer partial block<br />
161161
Assert.Equal(expected, result);
162162
}
163163

164+
// issue: https://github.com/Handlebars-Net/Handlebars.Net/issues/515
165+
[Fact]
166+
public void ValidContextInNestedPartialBlock()
167+
{
168+
const string template = @"{{#> [a/b] c=this }}{{c.value}}{{/ [a/b] }}";
169+
const string partial = "{{c.value}} {{> @partial-block }}";
170+
171+
var handlebars = Handlebars.Create();
172+
handlebars.RegisterTemplate("a/b", @partial);
173+
174+
var callback = handlebars.Compile(template);
175+
var result = callback(new { value = 42 });
176+
177+
const string expected = @"42 42";
178+
Assert.Equal(expected, result);
179+
}
180+
164181
// issue: https://github.com/Handlebars-Net/Handlebars.Net/issues/395
165182
[Fact]
166183
public void RenderingWithUnusedPartial()

0 commit comments

Comments
 (0)