From eb0eb8d4ca44fd53139a87af3b04cc8009c620bd Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 30 May 2020 13:47:13 -0400 Subject: [PATCH] Add priority tests for the other block types except helpers since I do not yet have a helper implemented that sets a value. --- .../explicit_context_setting/README.md | 2 ++ .../explicit_context_setting/main.dust | 35 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/js/test_cases/explicit_context_setting/README.md b/js/test_cases/explicit_context_setting/README.md index 99751c6..8c7c820 100644 --- a/js/test_cases/explicit_context_setting/README.md +++ b/js/test_cases/explicit_context_setting/README.md @@ -41,6 +41,8 @@ Explicitly setting a context on a block does work. The explicit context for blocks is evaluated in the context for that template file containing the block, not the inline partial (so, whatever the context is when we invoke the partial containing the block). +Parameters on blocks and inline partials appear to not be read but they do not error out. + References ---------- diff --git a/js/test_cases/explicit_context_setting/main.dust b/js/test_cases/explicit_context_setting/main.dust index 7313042..e9b92d0 100644 --- a/js/test_cases/explicit_context_setting/main.dust +++ b/js/test_cases/explicit_context_setting/main.dust @@ -327,7 +327,7 @@ Section vs Partial priority{~n} {/some_global} {>priority:explicit pet="snake"/} -Section vs Exists priority{~n} +Exists vs Partial priority{~n} =========================={~n} {?some_global:explicit pet="snake"} {pet}{~n} @@ -373,3 +373,36 @@ Section Loop set $idx in explicit context and parameter{~n} $len is {$len}{~n} {/loop} +{! Lets check the priority order for all the tag types now that we know that sections and partials have a different order !} +Section vs Partial priority{~n} +==========================={~n} +{#some_global:explicit pet="snake"} + {pet}{~n} +{/some_global} +{>priority:explicit pet="snake"/} + +Exists vs Section priority{~n} +=========================={~n} +{?some_global:explicit pet="snake"} + {pet}{~n} +{/some_global} +{>priority:explicit pet="snake"/} + +Not Exists vs Section priority{~n} +=============================={~n} +{^empty_array:explicit pet="snake"} + {pet}{~n} +{/empty_array} +{>priority:explicit pet="snake"/} + +{! TODO: Add helpers once we have a helper that sets a variable !} + +{! Do blocks or inline partials have parameters? !} +Do blocks or inline partials have parameters{~n} +============================================{~n} +{+some_block_override pet="snake" name="cuddlebunny"} + {pet}, {name}{~n} +{/some_block_override} +{