mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
perf: parse filenames in parse() insteadof render()
This commit is contained in:
@@ -44,7 +44,7 @@ describe('tags/include', function () {
|
||||
})
|
||||
return liquid.renderFile('/parent.html').catch(function (e) {
|
||||
expect(e.name).to.equal('RenderError')
|
||||
expect(e.message).to.match(/illegal filename "not-exist"/)
|
||||
expect(e.message).to.match(/illegal filename "undefined"/)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('tags/layout', function () {
|
||||
})
|
||||
return liquid.renderFile('/parent.html').catch(function (e) {
|
||||
expect(e.name).to.equal('RenderError')
|
||||
expect(e.message).to.contain('file "foo"("undefined") not available')
|
||||
expect(e.message).to.contain('illegal filename "undefined"')
|
||||
})
|
||||
})
|
||||
it('should handle layout none', async function () {
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('tags/render', function () {
|
||||
})
|
||||
return liquid.renderFile('/parent.html').catch(function (e) {
|
||||
expect(e.name).to.equal('RenderError')
|
||||
expect(e.message).to.match(/illegal filename "not-exist":"undefined"/)
|
||||
expect(e.message).to.match(/illegal filename "undefined"/)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -269,9 +269,8 @@ describe('error', function () {
|
||||
.to.throw(RenderError, /intended render error/)
|
||||
})
|
||||
it('should contain original error info for {% include %}', function () {
|
||||
const origin = ['1st', '2nd', '3rd', 'X{%throwingTag%} Y', '5th', '6th', '7th']
|
||||
mock({
|
||||
'/throwing-tag.html': origin.join('\n')
|
||||
'/throwing-tag.html': ['1st', '2nd', '3rd', 'X{%throwingTag%} Y', '5th', '6th', '7th'].join('\n')
|
||||
})
|
||||
const html = '{%include "throwing-tag.html"%}'
|
||||
const message = [
|
||||
|
||||
@@ -8,14 +8,14 @@ chai.use(sinonChai)
|
||||
const expect = chai.expect
|
||||
|
||||
describe('PropertyAccessToken', function () {
|
||||
describe('getVariableAsText', function () {
|
||||
describe('#propertyName', function () {
|
||||
it('should return correct value for IdentifierToken', function () {
|
||||
const token = new PropertyAccessToken(new IdentifierToken('foo', 0, 3), [], 3)
|
||||
expect(token.getVariableAsText()).to.equal('foo')
|
||||
expect(token.propertyName).to.equal('foo')
|
||||
})
|
||||
it('should return correct value for QuotedToken', function () {
|
||||
const token = new PropertyAccessToken(new QuotedToken('"foo bar"', 0, 9), [], 9)
|
||||
expect(token.getVariableAsText()).to.equal('foo bar')
|
||||
expect(token.propertyName).to.equal('foo bar')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user