Skip to content

Commit

Permalink
Add block indentation specs (mustache#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jan 26, 2024
1 parent ff88367 commit 1cf36d6
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions specs/~inheritance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,72 @@ tests:
partials:
parent: "{{#nested}}{{$block}}You say {{fruit}}.{{/block}}{{/nested}}"
expected: I say bananas.

- name: Standalone parent
desc: A parent's opening and closing tags need not be on separate lines in order to be standalone
data: {}
template: |
Hi,
{{<parent}}{{/parent}}
partials:
parent: |
one
two
expected: |
Hi,
one
two
- name: Standalone block
desc: A block's opening and closing tags need not be on separate lines in order to be standalone
data: {}
template: |
{{<parent}}{{$block}}
one
two{{/block}}
{{/parent}}
partials:
parent: |
Hi,
{{$block}}{{/block}}
expected: |
Hi,
one
two
- name: Block reindentation
desc: Block indentation is removed at the site of definition and added at the site of expansion
data: {}
template: |
{{<parent}}{{$block}}
one
two
{{/block}}{{/parent}}
partials:
parent: |
Hi,
{{$block}}
{{/block}}
expected: |
Hi,
one
two
- name: Intrinsic indentation
desc: When the block opening tag is standalone, indentation is determined by default content
data: {}
template: |
{{<parent}}{{$block}}
one
two
{{/block}}{{/parent}}
partials:
parent: |
Hi,
{{$block}}
default
{{/block}}
expected: |
Hi,
one
two

0 comments on commit 1cf36d6

Please sign in to comment.