fix: contains regression (#677)

* fix: `contains` regression on string-like objects, #675

* chore: fix build docs on macos
This commit is contained in:
Jun Yang
2024-03-21 23:56:10 +08:00
committed by GitHub
parent 01029aba87
commit 05223c4378
3 changed files with 19 additions and 14 deletions
+14
View File
@@ -485,4 +485,18 @@ describe('Issues', function () {
'{% endif %}', {})
expect(result).toEqual('show')
})
it('#675 10.10.1 Operator: contains regression', () => {
const engine = new Liquid()
class StrictStringForLiquid {
constructor (private value: string) {}
indexOf (other: unknown) {
return this.value.indexOf(String(other))
}
}
const result = engine.parseAndRenderSync('{{ str contains sub }}', {
str: new StrictStringForLiquid('string'),
sub: 'str'
})
expect(result).toEqual('true')
})
})