Adding more tests.
This commit is contained in:
parent
d93602d686
commit
9a0b28d80d
1
js/test_cases/block_context/base.dust
Normal file
1
js/test_cases/block_context/base.dust
Normal file
@ -0,0 +1 @@
|
||||
The block content is from {+inject/}
|
14
js/test_cases/block_context/input1.json
Normal file
14
js/test_cases/block_context/input1.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"people": [
|
||||
{
|
||||
"name": "Alice",
|
||||
"item": "cat"
|
||||
},
|
||||
{
|
||||
"name": "Bob"
|
||||
}
|
||||
],
|
||||
"pet": {
|
||||
"name": "fluffy"
|
||||
}
|
||||
}
|
6
js/test_cases/block_context/main.dust
Normal file
6
js/test_cases/block_context/main.dust
Normal file
@ -0,0 +1,6 @@
|
||||
{#pet}
|
||||
{>"base"/}
|
||||
{/pet}
|
||||
{#people}
|
||||
{<inject}by {name}{/inject}
|
||||
{/people}
|
@ -1 +1,5 @@
|
||||
Blocks seem to be rendered with the last inline partial of the same name.
|
||||
|
||||
Blocks appear to be able to be registered in a loop, however, their context is defined by the context during the call to the block `{+}` as opposed to when their override is defined by an inline partial `{<}`.
|
||||
|
||||
Even if the surrounding dust would prevent a section from being rendered, the inline context is still registered, which makes me think inline contexts are parsed out in a single pass regardless of the context.
|
||||
|
1
js/test_cases/block_unrendered/base.dust
Normal file
1
js/test_cases/block_unrendered/base.dust
Normal file
@ -0,0 +1 @@
|
||||
The block content is from {+inject/}
|
14
js/test_cases/block_unrendered/input1.json
Normal file
14
js/test_cases/block_unrendered/input1.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"people": [
|
||||
{
|
||||
"name": "Alice",
|
||||
"item": "cat"
|
||||
},
|
||||
{
|
||||
"name": "Bob"
|
||||
}
|
||||
],
|
||||
"pet": {
|
||||
"name": "fluffy"
|
||||
}
|
||||
}
|
10
js/test_cases/block_unrendered/main.dust
Normal file
10
js/test_cases/block_unrendered/main.dust
Normal file
@ -0,0 +1,10 @@
|
||||
{#pet}
|
||||
{>"base"/}
|
||||
{/pet}
|
||||
{#people}
|
||||
{<inject}by {name}{/inject}
|
||||
{/people}
|
||||
{#cake}
|
||||
OMG CAKE
|
||||
{<inject}with cake{/inject}
|
||||
{/cake}
|
Loading…
x
Reference in New Issue
Block a user