File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 230230 "parent" : " {{$foo}}default content{{/foo}}"
231231 },
232232 "expected" : " default content"
233+ },
234+ {
235+ "name" : " Block scope" ,
236+ "desc" : " Scope of a substituted block is evaluated in the context of the parent template" ,
237+ "data" : {
238+ "fruit" : " apples" ,
239+ "nested" : {
240+ "fruit" : " bananas"
241+ }
242+ },
243+ "template" : " {{<parent}}{{$block}}I say {{fruit}}.{{/block}}{{/parent}}" ,
244+ "partials" : {
245+ "parent" : " {{#nested}}{{$block}}You say {{fruit}}.{{/block}}{{/nested}}"
246+ },
247+ "expected" : " I say bananas."
233248 }
234249 ]
235250}
Original file line number Diff line number Diff line change @@ -224,3 +224,14 @@ tests:
224224 partials :
225225 parent : " {{$foo}}default content{{/foo}}"
226226 expected : default content
227+
228+ - name : Block scope
229+ desc : Scope of a substituted block is evaluated in the context of the parent template
230+ data :
231+ fruit : apples
232+ nested :
233+ fruit : bananas
234+ template : " {{<parent}}{{$block}}I say {{fruit}}.{{/block}}{{/parent}}"
235+ partials :
236+ parent : " {{#nested}}{{$block}}You say {{fruit}}.{{/block}}{{/nested}}"
237+ expected : I say bananas.
You can’t perform that action at this time.
0 commit comments