@@ -178,6 +178,19 @@ describe('tags/for', function () {
178
178
const html = await liquid . parseAndRender ( src , scope )
179
179
return expect ( html ) . toBe ( ' before before' )
180
180
} )
181
+ it ( 'should continue current forloop only' , async ( ) => {
182
+ const src = `
183
+ {%- for i in (1..2) -%}
184
+ i:{{ i }},
185
+ {%- for j in (1..2) -%}
186
+ j:{{ j }},
187
+ {%- continue -%}
188
+ after
189
+ {%- endfor -%}
190
+ {%- endfor -%}`
191
+ const html = await liquid . parseAndRender ( src , scope )
192
+ return expect ( html ) . toBe ( 'i:1,j:1,j:2,i:2,j:1,j:2,' )
193
+ } )
181
194
} )
182
195
describe ( 'break' , function ( ) {
183
196
it ( 'should support break' , async function ( ) {
@@ -196,6 +209,27 @@ describe('tags/for', function () {
196
209
const html = await liquid . parseAndRender ( src , scope )
197
210
return expect ( html ) . toBe ( '123breaking' )
198
211
} )
212
+ it ( 'should not break template outside of forloop' , async ( ) => {
213
+ const src = '{% for i in (1..5) %}' +
214
+ '{{ i }}' +
215
+ '{% break %}' +
216
+ '{% endfor %}' +
217
+ ' after'
218
+ const html = await liquid . parseAndRender ( src , scope )
219
+ return expect ( html ) . toBe ( '1 after' )
220
+ } )
221
+ it ( 'should not break parent forloop' , async function ( ) {
222
+ const src = `
223
+ {%- for i in (1..3) -%}
224
+ i:{{ i }},
225
+ {%- for j in (1..3) -%}
226
+ j:{{ j }},
227
+ {%- break -%}
228
+ {%- endfor -%}
229
+ {%- endfor -%}`
230
+ const html = await liquid . parseAndRender ( src , scope )
231
+ return expect ( html ) . toBe ( 'i:1,j:1,i:2,j:1,i:3,j:1,' )
232
+ } )
199
233
} )
200
234
201
235
describe ( 'limit' , function ( ) {
0 commit comments