fix: remove_last was eating an extra character

This commit is contained in:
Francisco Soto
2023-08-17 21:43:21 +08:00
committed by Jun Yang
parent 3bd8d2e557
commit fc2731376f
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -203,6 +203,10 @@ describe('filters/string', function () {
return test('{{ "I strained to see the train through the rain" | remove_last: "rain" }}',
'I strained to see the train through the ')
})
it('should remove the last occurrence of substring in the middle of a string', function () {
return test('{{ "I strained to see the train through the rain and fog" | remove_last: "rain" }}',
'I strained to see the train through the and fog')
})
it('should handle substring not found', function () {
return test('{{ "I strained to see the train through the rain" | remove_last: "no such thing" }}',
'I strained to see the train through the rain')