mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: math filters now return number, resolves #110
* fix linting
* numbers are no longer fixed:
i.e. {{0.3 | minus 0.1}} now renders as 0.19999
Stick to JavaScript number behavior, see: 8.0.0
This commit is contained in:
@@ -7,29 +7,29 @@ describe('drop/drop', function () {
|
||||
|
||||
class CustomDrop extends Liquid.Types.Drop {
|
||||
name: string = 'NAME'
|
||||
getName() {
|
||||
getName () {
|
||||
return 'GETNAME'
|
||||
}
|
||||
}
|
||||
class CustomDropWithMethodMissing extends CustomDrop {
|
||||
liquidMethodMissing(key: string) {
|
||||
liquidMethodMissing (key: string) {
|
||||
return key.toUpperCase()
|
||||
}
|
||||
}
|
||||
it('should call corresponding method', async function () {
|
||||
const html = await liquid.parseAndRender(`{{obj.getName}}`, {obj: new CustomDrop()})
|
||||
const html = await liquid.parseAndRender(`{{obj.getName}}`, { obj: new CustomDrop() })
|
||||
expect(html).to.equal('GETNAME')
|
||||
})
|
||||
it('should read corresponding property', async function () {
|
||||
const html = await liquid.parseAndRender(`{{obj.name}}`, {obj: new CustomDrop()})
|
||||
const html = await liquid.parseAndRender(`{{obj.name}}`, { obj: new CustomDrop() })
|
||||
expect(html).to.equal('NAME')
|
||||
})
|
||||
it('should output empty string if not exist', async function () {
|
||||
const html = await liquid.parseAndRender(`{{obj.foo}}`, {obj: new CustomDrop()})
|
||||
const html = await liquid.parseAndRender(`{{obj.foo}}`, { obj: new CustomDrop() })
|
||||
expect(html).to.equal('')
|
||||
})
|
||||
it('should respect liquidMethodMissing', async function () {
|
||||
const html = await liquid.parseAndRender(`{{obj.foo}}`, {obj: new CustomDropWithMethodMissing()})
|
||||
const html = await liquid.parseAndRender(`{{obj.foo}}`, { obj: new CustomDropWithMethodMissing() })
|
||||
expect(html).to.equal('FOO')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user