docs: more specific description of strftime

This commit is contained in:
harttle
2020-04-19 13:15:11 +08:00
parent 83b46bd25d
commit 2fa4edaa84
3 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -75,11 +75,17 @@ describe('tags/assign', function () {
const html = await liquid.parseAndRender(src, { num: 1 })
return expect(html).to.equal('11')
})
it('should write to the belonging scope', async function () {
it('should write to the root scope', async function () {
const src = '{%for a in (1..2)%}{%assign num = a%}{{a}}{%endfor%} {{num}}'
const html = await liquid.parseAndRender(src, { num: 1 })
return expect(html).to.equal('12 2')
})
it('should not change input scope', async function () {
const src = '{%for a in (1..2)%}{%assign num = a%}{{a}}{%endfor%} {{num}}'
const ctx = { num: 1 }
await liquid.parseAndRender(src, ctx)
return expect(ctx.num).to.equal(1)
})
})
it('should support sync', function () {
const src = '{% assign foo="bar" %}{{foo}}'