summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Appel <Dan.appel00@gmail.com>2021-12-07 09:33:17 -0800
committerGitHub <noreply@github.com>2021-12-07 09:33:17 -0800
commitb2aeb3c283de931a7004b5f7a2cb394b89382369 (patch)
treed711307f4d0e91f6883412f9d8853134a459e909
parentbb63070e701e6e5ba9fa0b4adaa259a0ef8115be (diff)
parentb2c18e51fd55d5f15a0a51048d4a70a6016740cd (diff)
downloadmustache-spec-b2aeb3c283de931a7004b5f7a2cb394b89382369.tar.gz
Merge pull request #129 from jgonggrijp/inheritance-scope-resolutionv1.2.2
-rw-r--r--specs/~inheritance.json15
-rw-r--r--specs/~inheritance.yml11
2 files changed, 26 insertions, 0 deletions
diff --git a/specs/~inheritance.json b/specs/~inheritance.json
index fedb34b..0a6878b 100644
--- a/specs/~inheritance.json
+++ b/specs/~inheritance.json
@@ -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."
}
]
}
diff --git a/specs/~inheritance.yml b/specs/~inheritance.yml
index 07fa081..5a24ba8 100644
--- a/specs/~inheritance.yml
+++ b/specs/~inheritance.yml
@@ -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.