Expand the explicit context setting test to prove that injected_context gets inserted AFTER the current context when an explicit context is used.
This commit is contained in:
parent
17121aa85b
commit
4ce0899279
@ -17,6 +17,8 @@ Explicitly setting a context in a partial also works. The explicit context takes
|
||||
|
||||
This works for both regular named partials and quoted partials.
|
||||
|
||||
While normally parameters are injected 1 level above the current context, if both parameters and explicit are set, they are injected below the current context. So if the context tree was `1->2->3`, with just parameters you'd have `1->2->parameters->3` but with an explicit context you have `1->2->3->parameters->explicit`.
|
||||
|
||||
Helpers
|
||||
-------
|
||||
|
||||
|
@ -4,17 +4,20 @@
|
||||
{
|
||||
"person": {
|
||||
"name": "Alice"
|
||||
}
|
||||
},
|
||||
"friend": "Bob"
|
||||
},
|
||||
{
|
||||
"person": {
|
||||
"name": "Bob"
|
||||
}
|
||||
},
|
||||
"friend": "Chris"
|
||||
},
|
||||
{
|
||||
"person": {
|
||||
"name": "Chris"
|
||||
}
|
||||
},
|
||||
"friend": "Alice"
|
||||
}
|
||||
],
|
||||
"explicit": {
|
||||
|
@ -255,3 +255,17 @@ Falsey Explicit Path Explicit{~n}
|
||||
{.|js}{~n}
|
||||
{/foo}
|
||||
{/loop}
|
||||
|
||||
{! Since partial parameters are normally injected 1 level above the current context, and explicit contexts are below the partial parameters, is the order parameters->current_context->explicit or current_context->parameters->explicit when both are being used? !}
|
||||
Partial Overloaded Regular with parameters{~n}
|
||||
=========================================={~n}
|
||||
{#loop}
|
||||
{>other_friend friend="Dave" pet="rabbit"/}
|
||||
{/loop}
|
||||
|
||||
Partial Overloaded Explicit with parameters{~n}
|
||||
==========================================={~n}
|
||||
{#loop}
|
||||
{>other_friend:explicit friend="Dave" pet="rabbit"/}
|
||||
{/loop}
|
||||
|
||||
|
1
js/test_cases/explicit_context_setting/other_friend.dust
Normal file
1
js/test_cases/explicit_context_setting/other_friend.dust
Normal file
@ -0,0 +1 @@
|
||||
{$idx}: {person.name}'s friend {friend} has a pet {pet} but not a {some_global}{~n}
|
Loading…
x
Reference in New Issue
Block a user