mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: handle undefined replacement argument in replace filter (#864)
This commit is contained in:
@@ -109,6 +109,14 @@ describe('filters/string', function () {
|
||||
return test('{{ "Take my protein pills and put my helmet on" | replace: "my", "your" }}',
|
||||
'Take your protein pills and put your helmet on')
|
||||
})
|
||||
it('should support replace with undefined replacement', function () {
|
||||
return test('{{ "Take my protein pills and put my helmet on" | replace: "my" }}',
|
||||
'Take protein pills and put helmet on')
|
||||
})
|
||||
it('should support replace with undefined variable as replacement', function () {
|
||||
return test('{{ "Take my protein pills and put my helmet on" | replace: "my", missing_variable }}',
|
||||
'Take protein pills and put helmet on')
|
||||
})
|
||||
it('should support replace_first', function () {
|
||||
return test('{% assign my_string = "Take my protein pills and put my helmet on" %}\n' +
|
||||
'{{ my_string | replace_first: "my", "your" }}',
|
||||
|
||||
Reference in New Issue
Block a user