mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: globals shared between tags, see #185
This commit is contained in:
@@ -76,6 +76,19 @@ describe('tags/render', function () {
|
||||
return expect(html).to.equal('InParent: harttle InChild: ')
|
||||
})
|
||||
|
||||
it('should be able to access globals', async function () {
|
||||
mock({
|
||||
'/hash.html': 'InParent: {{name}} {% render "user.html" %}',
|
||||
'/user.html': 'InChild: {{name}}'
|
||||
})
|
||||
const html = await liquid.renderFile('hash.html', {
|
||||
name: 'harttle'
|
||||
}, {
|
||||
globals: { name: 'Harttle' }
|
||||
})
|
||||
return expect(html).to.equal('InParent: harttle InChild: Harttle')
|
||||
})
|
||||
|
||||
it('should support render: with', async function () {
|
||||
mock({
|
||||
'/with.html': '{% render "color" with "red", shape: "rect" %}',
|
||||
|
||||
@@ -57,4 +57,4 @@ describe('parseStringLiteral()', function () {
|
||||
it('should parse slash escape', () => {
|
||||
expect(parseStringLiteral(String.raw`'fo\\o'`)).to.equal('fo\\o')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user