refactor: remove /dist from repo

This commit is contained in:
harttle
2019-02-24 23:03:12 +08:00
parent f9f35ebd6c
commit 407ac6d0a4
185 changed files with 44 additions and 6025 deletions
+52
View File
@@ -0,0 +1,52 @@
import { expect } from 'chai'
import Liquid from 'src/liquid'
describe('drop/blank-drop', function () {
let liquid: Liquid
before(() => (liquid = new Liquid()))
it('render blank drop as blank string', async function () {
const html = await liquid.parseAndRender('{{blank}}')
expect(html).to.equal('')
})
it('blank equals nil', async function () {
const src = '{%if blank == nil %}blank == nil{%else%}blank != nil{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('blank == nil')
})
it('false is blank', async function () {
const src = '{%if false == blank %}false == blank{%else%}false != blank{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false == blank')
})
it('"" is blank', async function () {
const src = '{%if "" == blank %}"" == blank{%else%}"" != blank{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('"" == blank')
})
it('" " is blank', async function () {
const src = '{%if " " == blank %}" " == blank{%else%}" " != blank{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('" " == blank')
})
it('{} is blank', async function () {
const src = '{%if obj == blank %}{} == blank{%else%}{} != blank{% endif %}'
const html = await liquid.parseAndRender(src, { obj: {} })
expect(html).to.equal('{} == blank')
})
it('{foo: 1} is not blank', async function () {
const src = '{%if obj == blank %}{foo: 1} == blank{%else%}{foo: 1} != blank{% endif %}'
const html = await liquid.parseAndRender(src, { obj: { foo: 1 } })
expect(html).to.equal('{foo: 1} != blank')
})
it('[] is blank', async function () {
const src = '{%if arr == blank %}[] == blank{%else%}[] != blank{% endif %}'
const html = await liquid.parseAndRender(src, { arr: [] })
expect(html).to.equal('[] == blank')
})
it('[1] is not blank', async function () {
const src = '{%if arr == blank %}[1] == blank{%else%}[1] != blank{% endif %}'
const html = await liquid.parseAndRender(src, { arr: [1] })
expect(html).to.equal('[1] != blank')
})
})
+82
View File
@@ -0,0 +1,82 @@
import { expect } from 'chai'
import Liquid from 'src/liquid'
describe('drop/empty-drop', function () {
let liquid: Liquid
before(() => (liquid = new Liquid()))
it('render empty drop as empty string', async function () {
const html = await liquid.parseAndRender('{{empty}}')
expect(html).to.equal('')
})
it('nil is not empty', async function () {
const src = '{%if nil == empty %}nil == empty{%else%}nil != empty{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('nil != empty')
})
it('false is not empty', async function () {
const src = '{%if false == empty %}false == empty{%else%}false != empty{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false != empty')
})
it('"" is empty', async function () {
const src = '{%if "" == empty %}"" == empty{%else%}"" != empty{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('"" == empty')
})
it('" " is not empty', async function () {
const src = '{%if " " == empty %}" " == empty{%else%}" " != empty{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('" " != empty')
})
it('{} is empty', async function () {
const src = '{%if obj == empty %}{} == empty{%else%}{} != empty{% endif %}'
const html = await liquid.parseAndRender(src, { obj: {} })
expect(html).to.equal('{} == empty')
})
it('{foo: 1} is not empty', async function () {
const src = '{%if obj == empty %}{foo: 1} == empty{%else%}{foo: 1} != empty{% endif %}'
const html = await liquid.parseAndRender(src, { obj: { foo: 1 } })
expect(html).to.equal('{foo: 1} != empty')
})
it('[] is empty', async function () {
const src = '{%if arr == empty %}[] == empty{%else%}[] != empty{% endif %}'
const html = await liquid.parseAndRender(src, { arr: [] })
expect(html).to.equal('[] == empty')
})
it('[1] is not empty', async function () {
const src = '{%if arr == empty %}[1] == empty{%else%}[1] != empty{% endif %}'
const html = await liquid.parseAndRender(src, { arr: [1] })
expect(html).to.equal('[1] != empty')
})
it('1 < empty should be false', async function () {
const src = '{%if 1 < empty %}true{%else%}false{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false')
})
it('1 <= empty should be false', async function () {
const src = '{%if 1 <= empty %}true{%else%}false{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false')
})
it('1 > empty should be false', async function () {
const src = '{%if 1 > empty %}true{%else%}false{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false')
})
it('1 >= empty should be false', async function () {
const src = '{%if 1 >= empty %}true{%else%}false{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false')
})
it('1 == empty should be false', async function () {
const src = '{%if 1 == empty %}true{%else%}false{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('false')
})
it('1 != empty should be true', async function () {
const src = '{%if 1 != empty %}true{%else%}false{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('true')
})
})
+36
View File
@@ -0,0 +1,36 @@
import { expect } from 'chai'
import Liquid from 'src/liquid'
describe('drop/null-drop', function () {
let liquid: Liquid
before(() => (liquid = new Liquid()))
it('render nil as empty string', async function () {
const html = await liquid.parseAndRender('{{nil}}')
expect(html).to.equal('')
})
it('render null as empty string', async function () {
const html = await liquid.parseAndRender('{{null}}')
expect(html).to.equal('')
})
it('undefined variable should equal to null', async function () {
const src = '{%if foo == nil %}foo == nil{%else%}foo != nil{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('foo == nil')
})
it('nil equals blank', async function () {
const src = '{%if nil == blank %}nil == blank{%else%}nil != blank{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('nil == blank')
})
it('0 should not equal to null', async function () {
const src = '{%if 0 == null %}0 == null{%else%}0 != null{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('0 != null')
})
it('nil should equal to null', async function () {
const src = '{%if nil == null %}nil == null{%else%}nil != null{% endif %}'
const html = await liquid.parseAndRender(src)
expect(html).to.equal('nil == null')
})
})