fix: empty tagToken.args since 10.20.0, fixes #796

This commit is contained in:
Harttle
2025-02-09 22:49:40 +08:00
committed by Yang Jun
parent 1a893f8023
commit 38a0f510b0
2 changed files with 10 additions and 5 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
import { TopLevelToken, TagToken, Tokenizer, Context, Liquid, Drop, toValueSync, LiquidError } from '../..'
import { TopLevelToken, TagToken, Tokenizer, Context, Liquid, Drop, toValueSync, LiquidError, IfTag } from '../..'
const LiquidUMD = require('../../dist/liquid.browser.umd.js').Liquid
describe('Issues', function () {
@@ -558,4 +558,11 @@ describe('Issues', function () {
CSharp <sup>2</sup> Posts:page2,page4,
CPP <sup>1</sup> Posts:page0,`)
})
it('if tag condition, the token args is empty #796', () => {
const tpl = 'Hello, {% if name %} {{ name }} {% else %} user {% endif %}'
const engine = new Liquid()
const parsed = engine.parse(tpl)
const ifToken = parsed[1]
expect((ifToken as IfTag).token.args).toEqual('name')
})
})