From d791d8ed9f838830156c0b2a2fc487f2e1490843 Mon Sep 17 00:00:00 2001 From: Patrick Hensley Date: Thu, 9 May 2024 10:21:33 -0400 Subject: [PATCH] Add test case for variable resolution coverage --- .../template/plugins/f-macro-12.html | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 core/src/test/resources/com/squarespace/template/plugins/f-macro-12.html diff --git a/core/src/test/resources/com/squarespace/template/plugins/f-macro-12.html b/core/src/test/resources/com/squarespace/template/plugins/f-macro-12.html new file mode 100644 index 0000000..6073340 --- /dev/null +++ b/core/src/test/resources/com/squarespace/template/plugins/f-macro-12.html @@ -0,0 +1,36 @@ +:JSON +{ + "one": { + "two": { + "key": "hello" + } + }, + "@": { + "@": "X" + } +} + +:PARTIALS +{ + "m2": "{.if @}pass2{.or}fail2{.end} {@|json}" +} + +:TEMPLATE +{.macro m1}{.if @}pass1{.or}fail1{.end} {@|apply m2}{.end} + +{@|apply m1} +{@.one|apply m1} +{@.one.two|apply m1} + +{@.one.two.three|apply m1} +{@.two|apply m1} +{missing|apply m1} + +:OUTPUT +pass1 pass2 {"one":{"two":{"key":"hello"}},"@":{"@":"X"}} +pass1 pass2 {"two":{"key":"hello"}} +pass1 pass2 {"key":"hello"} + +fail1 fail2 +fail1 fail2 +fail1 fail2