import { compile } from '../../../packages/weex-template-compiler' import { strToRegExp } from '../helpers/index' describe('append props', () => { it('add append="tree" on ', () => { const { render, staticRenderFns, errors } = compile(``) expect(render).not.toBeUndefined() expect(staticRenderFns).not.toBeUndefined() expect(staticRenderFns.length).toEqual(1) expect(staticRenderFns).toMatch(strToRegExp(`appendAsTree:true`)) expect(staticRenderFns).toMatch(strToRegExp(`attrs:{"append":"tree"}`)) expect(errors).toEqual([]) }) it('override append="node" on ', () => { const { render, staticRenderFns, errors } = compile(``) expect(render + staticRenderFns).toMatch(strToRegExp(`attrs:{"append":"node"}`)) expect(errors).toEqual([]) }) it('add append="tree" on
', () => { const { render, staticRenderFns, errors } = compile(`
`) expect(render + staticRenderFns).toMatch(strToRegExp(`appendAsTree:true`)) expect(render + staticRenderFns).toMatch(strToRegExp(`attrs:{"append":"tree"}`)) expect(errors).toEqual([]) }) it('add append="tree" on ', () => { const { render, staticRenderFns, errors } = compile(`
`) expect(render + staticRenderFns).toMatch(strToRegExp(`appendAsTree:true`)) expect(render + staticRenderFns).toMatch(strToRegExp(`"append":"tree"`)) expect(errors).toEqual([]) }) it('add append="tree" on ', () => { const { render, staticRenderFns, errors } = compile(``) expect(render + staticRenderFns).toMatch(strToRegExp(`appendAsTree:true`)) expect(render + staticRenderFns).toMatch(strToRegExp(`attrs:{"append":"tree"}`)) expect(errors).toEqual([]) }) it('override append="node" on ', () => { const { render, staticRenderFns, errors } = compile(``) expect(render + staticRenderFns).toMatch(strToRegExp(`attrs:{"append":"node"}`)) expect(errors).toEqual([]) }) })