mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -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:
@@ -1,8 +1,10 @@
|
||||
import Liquid from '../../../src/liquid'
|
||||
import * as chai from 'chai'
|
||||
import { mock, restore } from '../../stub/mockfs'
|
||||
import * as chaiAsPromised from 'chai-as-promised'
|
||||
|
||||
const expect = chai.expect
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
describe('Liquid', function () {
|
||||
describe('#plugin()', function () {
|
||||
@@ -34,6 +36,12 @@ describe('Liquid', function () {
|
||||
const html = await engine.parseAndRender(tpl)
|
||||
expect(html).to.equal('Welcome(to]Liquid')
|
||||
})
|
||||
it('should support for-in with variable', async function () {
|
||||
const src = '{% assign total = 3 | minus: 1 %}' +
|
||||
'{% for i in (1..total) %}{{ i }}{% endfor %}'
|
||||
const html = await engine.parseAndRender(src, {})
|
||||
return expect(html).to.equal('12')
|
||||
})
|
||||
})
|
||||
describe('#express()', function () {
|
||||
const liquid = new Liquid({ root: '/root' })
|
||||
|
||||
Reference in New Issue
Block a user