Skip to content

Commit

Permalink
Merge pull request #129 from jgonggrijp/inheritance-scope-resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Danappelxx authored Dec 7, 2021
2 parents bb63070 + b2c18e5 commit b2aeb3c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions specs/~inheritance.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,21 @@
"parent": "{{$foo}}default content{{/foo}}"
},
"expected": "default content"
},
{
"name": "Block scope",
"desc": "Scope of a substituted block is evaluated in the context of the parent template",
"data": {
"fruit": "apples",
"nested": {
"fruit": "bananas"
}
},
"template": "{{<parent}}{{$block}}I say {{fruit}}.{{/block}}{{/parent}}",
"partials": {
"parent": "{{#nested}}{{$block}}You say {{fruit}}.{{/block}}{{/nested}}"
},
"expected": "I say bananas."
}
]
}
11 changes: 11 additions & 0 deletions specs/~inheritance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,14 @@ tests:
partials:
parent: "{{$foo}}default content{{/foo}}"
expected: default content

- name: Block scope
desc: Scope of a substituted block is evaluated in the context of the parent template
data:
fruit: apples
nested:
fruit: bananas
template: "{{<parent}}{{$block}}I say {{fruit}}.{{/block}}{{/parent}}"
partials:
parent: "{{#nested}}{{$block}}You say {{fruit}}.{{/block}}{{/nested}}"
expected: I say bananas.

0 comments on commit b2aeb3c

Please sign in to comment.