Skip to content

Commit b2aeb3c

Browse files
authored
Merge pull request #129 from jgonggrijp/inheritance-scope-resolution
2 parents bb63070 + b2c18e5 commit b2aeb3c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

specs/~inheritance.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,21 @@
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
}

specs/~inheritance.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)