test(compiler-dom): add DOM compiler integration compile test (#189)

This commit is contained in:
Carlos Rodrigues 2019-10-11 15:13:55 +01:00 committed by Evan You
parent 3cdefdbe2d
commit a84490858f
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`compile should contain standard transforms 1`] = `
"const _Vue = Vue
const _createVNode = Vue.createVNode
const _hoisted_1 = {}
return function render() {
with (this) {
const { createVNode: _createVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
return (_openBlock(), _createBlock(_Fragment, null, [
_createVNode(\\"div\\", { textContent: text }, null, 8 /* PROPS */, [\\"textContent\\"]),
_createVNode(\\"div\\", { innerHTML: html }, null, 8 /* PROPS */, [\\"innerHTML\\"]),
_createVNode(\\"div\\", null, \\"test\\"),
_createVNode(\\"div\\", { style: _hoisted_1 }, \\"red\\", 4 /* STYLE */),
_createVNode(\\"div\\", { style: {color: 'green'}}, null, 4 /* STYLE */)
]))
}
}"
`;

View File

@ -0,0 +1,13 @@
import { compile } from '../src'
describe('compile', () => {
it('should contain standard transforms', () => {
const { code } = compile(`<div v-text="text"></div>
<div v-html="html"></div>
<div v-cloak>test</div>
<div style="color=red">red</div>
<div :style="{color: 'green'}"></div>`)
expect(code).toMatchSnapshot()
})
})