feature: support static filepath resolving by options.dynamicPartials,

fix #51
This commit is contained in:
harttle
2017-12-21 14:09:30 +08:00
parent 4cbfa6d204
commit ace271c7f0
7 changed files with 28 additions and 2 deletions
+10
View File
@@ -88,4 +88,14 @@ describe('tags/include', function () {
return expect(liquid.renderFile('personInfo.html', ctx)).to
.eventually.equal('This is a person <p>Joe Shmoe<br/>City: Dallas</p>')
})
it('should support static filename', function () {
var staticLiquid = new Liquid({dynamicPartials: false, root: '/'})
mock({
'/with.html': 'X{% include color.html shape: "rect" %}Y',
'/color.html': 'shape:{{shape}}'
})
return expect(staticLiquid.renderFile('with.html')).to
.eventually.equal('Xshape:rectY')
})
})
+9
View File
@@ -96,4 +96,13 @@ describe('tags/layout', function () {
return expect(liquid.renderFile('/main.html')).to
.eventually.equal('blackredA')
})
it('should support static filename', function () {
mock({
'/parent.html': '{{color}}{%block%}{%endblock%}',
'/main.html': '{% layout parent.html color:"black"%}{%block%}A{%endblock%}'
})
var staticLiquid = Liquid({ root: '/', dynamicPartials: false })
return expect(staticLiquid.renderFile('/main.html')).to
.eventually.equal('blackA')
})
})