@@ -658,6 +658,38 @@ test("Liquid Nested Paired Shortcode", async (t) => {
658
658
) ;
659
659
} ) ;
660
660
661
+ test ( "Liquid Paired Kwargs Shortcode with Tag Inside" , async ( t ) => {
662
+ let tr = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
663
+ tr . engine . addPairedShortcode ( "postfixWithZach" , function ( content , kwargs ) {
664
+ var { str } = kwargs ?? { } ;
665
+ return str + content + "Zach" ;
666
+ } ) ;
667
+
668
+ t . is (
669
+ await tr . _testRender (
670
+ "{% postfixWithZach str: name %}Content{% if tester %}If{% endif %}{% endpostfixWithZach %}" ,
671
+ { name : "test" , tester : true }
672
+ ) ,
673
+ "testContentIfZach"
674
+ ) ;
675
+ } ) ;
676
+
677
+ test ( "Liquid Nested Paired Kwargs Shortcode" , async ( t ) => {
678
+ let tr = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
679
+ tr . engine . addPairedShortcode ( "postfixWithZach" , function ( content , kwargs ) {
680
+ var { str } = kwargs ?? { } ;
681
+ return str + content + "Zach" ;
682
+ } ) ;
683
+
684
+ t . is (
685
+ await tr . _testRender (
686
+ "{% postfixWithZach str: name %}Content{% postfixWithZach str: name2 %}Content{% endpostfixWithZach %}{% endpostfixWithZach %}" ,
687
+ { name : "test" , name2 : "test2" }
688
+ ) ,
689
+ "testContenttest2ContentZachZach"
690
+ ) ;
691
+ } ) ;
692
+
661
693
test ( "Liquid Shortcode Multiple Args" , async ( t ) => {
662
694
let tr = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
663
695
tr . engine . addShortcode ( "postfixWithZach" , function ( str , str2 ) {
@@ -673,6 +705,56 @@ test("Liquid Shortcode Multiple Args", async (t) => {
673
705
) ;
674
706
} ) ;
675
707
708
+ test ( "Liquid Shortcode Keyword Arg" , async ( t ) => {
709
+ let tr = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
710
+ tr . engine . addShortcode ( "postfixWithZach" , function ( str , kwargs ) {
711
+ let { append } = kwargs ?? { } ;
712
+ return str + "Zach" + append ;
713
+ } ) ;
714
+
715
+ t . is (
716
+ await tr . _testRender ( "{% postfixWithZach name append: other %}" , {
717
+ name : "test" ,
718
+ other : "howdy" ,
719
+ } ) ,
720
+ "testZachhowdy"
721
+ ) ;
722
+ } ) ;
723
+
724
+ test ( "Liquid Shortcode Multiple Keyword Args" , async ( t ) => {
725
+ let tr = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
726
+ tr . engine . addShortcode ( "postfixWithZach" , function ( str , kwargs ) {
727
+ let { prepend, append } = kwargs ?? { } ;
728
+ return prepend + str + "Zach" + append ;
729
+ } ) ;
730
+
731
+ t . is (
732
+ await tr . _testRender (
733
+ "{% postfixWithZach name prepend: 'string' append: other %}" ,
734
+ {
735
+ name : "test" ,
736
+ other : "howdy" ,
737
+ }
738
+ ) ,
739
+ "stringtestZachhowdy"
740
+ ) ;
741
+ } ) ;
742
+
743
+ test ( "Liquid Shortcode Only Keyword Args" , async ( t ) => {
744
+ let tr = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
745
+ tr . engine . addShortcode ( "postfixWithZach" , function ( kwargs ) {
746
+ let { prepend, append } = kwargs ?? { } ;
747
+ return prepend + "Zach" + append ;
748
+ } ) ;
749
+
750
+ t . is (
751
+ await tr . _testRender ( "{% postfixWithZach prepend: 'string' append: name %}" , {
752
+ name : "test" ,
753
+ } ) ,
754
+ "stringZachtest"
755
+ ) ;
756
+ } ) ;
757
+
676
758
test ( "Liquid Include Scope Leak" , async ( t ) => {
677
759
let tr1 = await getNewTemplateRender ( "liquid" , "./test/stubs/" ) ;
678
760
t . is ( tr1 . getEngineName ( ) , "liquid" ) ;
0 commit comments