@@ -27,13 +27,6 @@ describe('filters/array', function () {
27
27
return expect ( render ( src ) ) . rejects . toThrow ( 'expected ":" after filter name, line:1, col:83' )
28
28
} )
29
29
} )
30
- describe ( 'last' , ( ) => {
31
- it ( 'should support last' , function ( ) {
32
- const src = '{{ arr | last }}'
33
- const scope = { arr : [ 'zebra' , 'octopus' , 'giraffe' , 'tiger' ] }
34
- return test ( src , scope , 'tiger' )
35
- } )
36
- } )
37
30
describe ( 'split' , ( ) => {
38
31
it ( 'should support split' , function ( ) {
39
32
const src = '{% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %}' +
@@ -263,6 +256,7 @@ describe('filters/array', function () {
263
256
it ( 'should return 0 for false' , ( ) => test ( '{{ false | size }}' , '0' ) )
264
257
it ( 'should return 0 for nil' , ( ) => test ( '{{ nil | size }}' , '0' ) )
265
258
it ( 'should return 0 for undefined' , ( ) => test ( '{{ foo | size }}' , '0' ) )
259
+ it ( 'should work for string' , ( ) => test ( '{{ "foo" | size }}' , { } , '3' ) )
266
260
} )
267
261
describe ( 'first' , function ( ) {
268
262
it ( 'should support first' , ( ) => test (
@@ -273,7 +267,7 @@ describe('filters/array', function () {
273
267
it ( 'should return empty for nil' , ( ) => test ( '{{nil | first}}' , '' ) )
274
268
it ( 'should return empty for undefined' , ( ) => test ( '{{foo | first}}' , '' ) )
275
269
it ( 'should return empty for false' , ( ) => test ( '{{false | first}}' , '' ) )
276
- it ( 'should return empty for string' , ( ) => test ( '{{"zebra " | first}}' , '' ) )
270
+ it ( 'should work for string' , ( ) => test ( '{{ "foo " | first }}' , 'f ' ) )
277
271
} )
278
272
describe ( 'last' , function ( ) {
279
273
it ( 'should support last' , ( ) => test (
@@ -284,7 +278,7 @@ describe('filters/array', function () {
284
278
it ( 'should return empty for nil' , ( ) => test ( '{{nil | last}}' , '' ) )
285
279
it ( 'should return empty for undefined' , ( ) => test ( '{{foo | last}}' , '' ) )
286
280
it ( 'should return empty for false' , ( ) => test ( '{{false | last}}' , '' ) )
287
- it ( 'should return empty for string' , ( ) => test ( '{{"zebra " | last}}' , ' ') )
281
+ it ( 'should work for string' , ( ) => test ( '{{ "foo " | last }}' , { } , 'o ') )
288
282
} )
289
283
describe ( 'slice' , function ( ) {
290
284
it ( 'should slice first char by 0' , ( ) => test ( '{{ "Liquid" | slice: 0 }}' , 'L' ) )
0 commit comments