Skip to content

Commit

Permalink
wip(vitest-migration): compiler-dom tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 26, 2023
1 parent 5804406 commit 8599242
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 96 deletions.
16 changes: 8 additions & 8 deletions packages/compiler-dom/__tests__/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1

exports[`compile should contain standard transforms 1`] = `
exports[`compile > should contain standard transforms 1`] = `
"const _Vue = Vue
return function render(_ctx, _cache) {
with (_ctx) {
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, normalizeStyle: _normalizeStyle, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock(_Fragment, null, [
_createElementVNode("div", {
_createElementVNode(\\"div\\", {
textContent: _toDisplayString(text)
}, null, 8 /* PROPS */, ["textContent"]),
_createElementVNode("div", { innerHTML: html }, null, 8 /* PROPS */, ["innerHTML"]),
_createElementVNode("div", null, "test"),
_createElementVNode("div", { style: {"color":"red"} }, "red"),
_createElementVNode("div", {
}, null, 8 /* PROPS */, [\\"textContent\\"]),
_createElementVNode(\\"div\\", { innerHTML: html }, null, 8 /* PROPS */, [\\"innerHTML\\"]),
_createElementVNode(\\"div\\", null, \\"test\\"),
_createElementVNode(\\"div\\", { style: {\\"color\\":\\"red\\"} }, \\"red\\"),
_createElementVNode(\\"div\\", {
style: _normalizeStyle({color: 'green'})
}, null, 4 /* STYLE */)
], 64 /* STABLE_FRAGMENT */))
Expand Down
3 changes: 3 additions & 0 deletions packages/compiler-dom/__tests__/decoderHtmlBrowser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @vitest-environment jsdom
*/
import { decodeHtmlBrowser } from '../src/decodeHtmlBrowser'

describe('decodeHtmlBrowser', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1

exports[`inject persisted when child has v-show 1`] = `
"const _Vue = Vue
Expand All @@ -7,9 +7,9 @@ return function render(_ctx, _cache) {
with (_ctx) {
const { vShow: _vShow, createElementVNode: _createElementVNode, withDirectives: _withDirectives, Transition: _Transition, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
return (_openBlock(), _createBlock(_Transition, { persisted: "" }, {
return (_openBlock(), _createBlock(_Transition, { persisted: \\"\\" }, {
default: _withCtx(() => [
_withDirectives(_createElementVNode("div", null, null, 512 /* NEED_PATCH */), [
_withDirectives(_createElementVNode(\\"div\\", null, null, 512 /* NEED_PATCH */), [
[_vShow, ok]
])
]),
Expand All @@ -29,15 +29,15 @@ return function render(_ctx, _cache) {
return (_openBlock(), _createBlock(_Transition, null, {
default: _withCtx(() => [
a
? (_openBlock(), _createElementBlock("div", { key: 0 }, "hey"))
? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }, \\"hey\\"))
: b
? (_openBlock(), _createElementBlock("div", { key: 1 }, "hey"))
: (_openBlock(), _createElementBlock("div", { key: 2 }, [
? (_openBlock(), _createElementBlock(\\"div\\", { key: 1 }, \\"hey\\"))
: (_openBlock(), _createElementBlock(\\"div\\", { key: 2 }, [
c
? (_openBlock(), _createElementBlock("p", { key: 0 }))
? (_openBlock(), _createElementBlock(\\"p\\", { key: 0 }))
: (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
_createCommentVNode(" this should not be ignored "),
_createElementVNode("p")
_createCommentVNode(\\" this should not be ignored \\"),
_createElementVNode(\\"p\\")
], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))
]))
]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1

exports[`stringify static html should bail on bindings that are hoisted but not stringifiable 1`] = `
exports[`stringify static html > should bail on bindings that are hoisted but not stringifiable 1`] = `
"const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("div", null, [
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"),
/*#__PURE__*/_createElementVNode("span", { class: "foo" }, "foo"),
/*#__PURE__*/_createElementVNode("img", { src: _imports_0_ })
const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"div\\", null, [
/*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"foo\\" }, \\"foo\\"),
/*#__PURE__*/_createElementVNode(\\"img\\", { src: _imports_0_ })
], -1 /* HOISTED */)
const _hoisted_2 = [
_hoisted_1
]
return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, _hoisted_2))
return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
}"
`;
exports[`stringify static html should work with bindings that are non-static but stringifiable 1`] = `
exports[`stringify static html > should work with bindings that are non-static but stringifiable 1`] = `
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<div><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><span class=\\"foo\\">foo</span><img src=\\"" + _imports_0_ + "\\"></div>", 1)
const _hoisted_1 = /*#__PURE__*/_createStaticVNode(\\"<div><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><span class=\\\\\\"foo\\\\\\">foo</span><img src=\\\\\\"\\" + _imports_0_ + \\"\\\\\\"></div>\\", 1)
const _hoisted_2 = [
_hoisted_1
]
return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, _hoisted_2))
return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
}"
`;
exports[`stringify static html stringify v-html 1`] = `
exports[`stringify static html > stringify v-html 1`] = `
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode } = Vue
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<pre data-type=\\"js\\"><code><span>show-it </span></code></pre><div class><span class>1</span><span class>2</span></div>", 2)
const _hoisted_1 = /*#__PURE__*/_createStaticVNode(\\"<pre data-type=\\\\\\"js\\\\\\"><code><span>show-it </span></code></pre><div class><span class>1</span><span class>2</span></div>\\", 2)
return function render(_ctx, _cache) {
return _hoisted_1
}"
`;
exports[`stringify static html stringify v-text 1`] = `
exports[`stringify static html > stringify v-text 1`] = `
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode } = Vue
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<pre data-type=\\"js\\"><code>&lt;span&gt;show-it &lt;/span&gt;</code></pre><div class><span class>1</span><span class>2</span></div>", 2)
const _hoisted_1 = /*#__PURE__*/_createStaticVNode(\\"<pre data-type=\\\\\\"js\\\\\\"><code>&lt;span&gt;show-it &lt;/span&gt;</code></pre><div class><span class>1</span><span class>2</span></div>\\", 2)
return function render(_ctx, _cache) {
return _hoisted_1
Expand Down
Loading

0 comments on commit 8599242

Please sign in to comment.