mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 00:55:13 -07:00
test: drop TagImplOptions-specific e2e coverage (#839)
Remove #570 v9 object-literal registration test and unused metadata_file setup in #573. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
+1
-22
@@ -1,21 +1,9 @@
|
|||||||
import { TopLevelToken, TagToken, Tokenizer, Context, Liquid, Drop, toValueSync, LiquidError, IfTag, Tag } from '../..'
|
import { Tokenizer, Context, Liquid, Drop, toValueSync, LiquidError, IfTag } from '../..'
|
||||||
import { spawnSync } from 'child_process'
|
import { spawnSync } from 'child_process'
|
||||||
import { resolve as resolvePath } from 'path'
|
import { resolve as resolvePath } from 'path'
|
||||||
const LiquidUMD = require('../../dist/liquid.browser.umd.js').Liquid
|
const LiquidUMD = require('../../dist/liquid.browser.umd.js').Liquid
|
||||||
|
|
||||||
describe('Issues', function () {
|
describe('Issues', function () {
|
||||||
class MetadataFileTag extends Tag {
|
|
||||||
str: string
|
|
||||||
constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {
|
|
||||||
super(token, remainTokens, liquid)
|
|
||||||
this.str = token.args
|
|
||||||
}
|
|
||||||
async render (ctx: Context) {
|
|
||||||
const content = await Promise.resolve(`{{${this.str}}}`)
|
|
||||||
return this.liquid.parseAndRender(content.toString(), ctx)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it('unicode blanks are not properly treated #221', async () => {
|
it('unicode blanks are not properly treated #221', async () => {
|
||||||
const engine = new Liquid({ strictVariables: true, strictFilters: true })
|
const engine = new Liquid({ strictVariables: true, strictFilters: true })
|
||||||
const html = engine.parseAndRenderSync('{{huh | truncate: 11}}', { huh: 'fdsafdsafdsafdsaaaaa' })
|
const html = engine.parseAndRenderSync('{{huh | truncate: 11}}', { huh: 'fdsafdsafdsafdsaaaaa' })
|
||||||
@@ -374,17 +362,8 @@ describe('Issues', function () {
|
|||||||
const html = await liquid.parseAndRender(tpl)
|
const html = await liquid.parseAndRender(tpl)
|
||||||
expect(html).toMatch(/^\s*This is a love or luck potion.\s+This is a strength or health or love potion.\s*$/)
|
expect(html).toMatch(/^\s*This is a love or luck potion.\s+This is a strength or health or love potion.\s*$/)
|
||||||
})
|
})
|
||||||
it('tag registration compatible to v9 #570', async () => {
|
|
||||||
const liquid = new Liquid()
|
|
||||||
liquid.registerTag('metadata_file', MetadataFileTag)
|
|
||||||
const tpl = '{% metadata_file foo %}'
|
|
||||||
const ctx = { foo: 'FOO' }
|
|
||||||
const html = await liquid.parseAndRender(tpl, ctx)
|
|
||||||
expect(html).toBe('FOO')
|
|
||||||
})
|
|
||||||
it('date filter should return parsed input when no format is provided #573', async () => {
|
it('date filter should return parsed input when no format is provided #573', async () => {
|
||||||
const liquid = new Liquid()
|
const liquid = new Liquid()
|
||||||
liquid.registerTag('metadata_file', MetadataFileTag)
|
|
||||||
const tpl = `{{ 'now' | date }}`
|
const tpl = `{{ 'now' | date }}`
|
||||||
const html = await liquid.parseAndRender(tpl)
|
const html = await liquid.parseAndRender(tpl)
|
||||||
// sample: Thursday, February 2, 2023 at 6:25 pm +0000
|
// sample: Thursday, February 2, 2023 at 6:25 pm +0000
|
||||||
|
|||||||
Reference in New Issue
Block a user