mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-29 18:47:39 +08:00
test: fix tests
This commit is contained in:
parent
08382f0080
commit
d30f6fd25f
@ -93,7 +93,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > scr
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
|
||||
const __default__ = {
|
||||
name: \\"test\\"
|
||||
name: "test"
|
||||
}
|
||||
|
||||
import { x } from './x'
|
||||
@ -553,7 +553,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (exp
|
||||
export interface Emits { (e: 'foo' | 'bar'): void }
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ({ (e: 'foo' | 'bar'): void }), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -569,7 +569,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (exp
|
||||
export type Emits = { (e: 'foo' | 'bar'): void }
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ({ (e: 'foo' | 'bar'): void }), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -601,7 +601,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (int
|
||||
interface Emits { (e: 'foo' | 'bar'): void }
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ({ (e: 'foo' | 'bar'): void }), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -617,7 +617,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (ref
|
||||
export type Emits = (e: 'foo' | 'bar') => void
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ((e: 'foo' | 'bar') => void), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -633,7 +633,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (ref
|
||||
type Emits = (e: 'foo' | 'bar') => void
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ((e: 'foo' | 'bar') => void), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -649,7 +649,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (typ
|
||||
type Emits = { (e: 'foo' | 'bar'): void }
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ({ (e: 'foo' | 'bar'): void }), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -664,7 +664,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type (typ
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\", \\"baz\\"],
|
||||
emits: ["foo", "bar", "baz"],
|
||||
setup(__props, { emit }: { emit: ({(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -679,7 +679,7 @@ exports[`SFC compile <script setup> > with TypeScript > defineEmits w/ type 1`]
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
emits: [\\"foo\\", \\"bar\\"],
|
||||
emits: ["foo", "bar"],
|
||||
setup(__props, { emit }: { emit: ((e: 'foo' | 'bar') => void), expose: any, slots: any, attrs: any }) {
|
||||
|
||||
|
||||
@ -894,9 +894,9 @@ exports[`SFC compile <script setup> > with TypeScript > runtime Enum in normal s
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
enum Foo { A = 123 }
|
||||
|
||||
export enum D { D = \\"D\\" }
|
||||
const enum C { C = \\"C\\" }
|
||||
enum B { B = \\"B\\" }
|
||||
export enum D { D = "D" }
|
||||
const enum C { C = "C" }
|
||||
enum B { B = "B" }
|
||||
|
||||
export default /*#__PURE__*/_defineComponent({
|
||||
setup(__props) {
|
||||
|
@ -5,7 +5,7 @@ exports[`CSS vars injection > codegen > <script> w/ default export 1`] = `
|
||||
import { useCssVars as _useCssVars } from 'vue'
|
||||
const __injectCSSVars__ = () => {
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_vm.color)
|
||||
"xxxxxxxx-color": (_vm.color)
|
||||
}))}
|
||||
const __setup__ = __default__.setup
|
||||
__default__.setup = __setup__
|
||||
@ -23,7 +23,7 @@ exports[`CSS vars injection > codegen > <script> w/ default export in strings/co
|
||||
import { useCssVars as _useCssVars } from 'vue'
|
||||
const __injectCSSVars__ = () => {
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_vm.color)
|
||||
"xxxxxxxx-color": (_vm.color)
|
||||
}))}
|
||||
const __setup__ = __default__.setup
|
||||
__default__.setup = __setup__
|
||||
@ -39,7 +39,7 @@ const __default__ = {}
|
||||
import { useCssVars as _useCssVars } from 'vue'
|
||||
const __injectCSSVars__ = () => {
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_vm.color)
|
||||
"xxxxxxxx-color": (_vm.color)
|
||||
}))}
|
||||
const __setup__ = __default__.setup
|
||||
__default__.setup = __setup__
|
||||
@ -56,7 +56,7 @@ export default {
|
||||
setup(__props) {
|
||||
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-width\\": (_setup.width)
|
||||
"xxxxxxxx-width": (_setup.width)
|
||||
}))
|
||||
const color = 'red';const width = 100
|
||||
return { color, width }
|
||||
@ -72,10 +72,10 @@ export default {
|
||||
setup(__props) {
|
||||
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-foo\\": (_setup.foo),
|
||||
\\"xxxxxxxx-foo____px_\\": (_setup.foo + 'px'),
|
||||
\\"xxxxxxxx-_a___b____2____px_\\": ((_setup.a + _setup.b) / 2 + 'px'),
|
||||
\\"xxxxxxxx-__a___b______2___a_\\": (((_setup.a + _setup.b)) / (2 * _setup.a))
|
||||
"xxxxxxxx-foo": (_setup.foo),
|
||||
"xxxxxxxx-foo____px_": (_setup.foo + 'px'),
|
||||
"xxxxxxxx-_a___b____2____px_": ((_setup.a + _setup.b) / 2 + 'px'),
|
||||
"xxxxxxxx-__a___b______2___a_": (((_setup.a + _setup.b)) / (2 * _setup.a))
|
||||
}))
|
||||
|
||||
let a = 100
|
||||
@ -95,7 +95,7 @@ export default {
|
||||
setup(__props) {
|
||||
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_setup.color)
|
||||
"xxxxxxxx-color": (_setup.color)
|
||||
}))
|
||||
const color = 'red'
|
||||
return { color }
|
||||
@ -111,7 +111,7 @@ export default {
|
||||
setup(__props) {
|
||||
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_setup.color)
|
||||
"xxxxxxxx-color": (_setup.color)
|
||||
}))
|
||||
|
||||
const color = 'red'
|
||||
@ -128,8 +128,8 @@ const __default__ = {}
|
||||
import { useCssVars as _useCssVars } from 'vue'
|
||||
const __injectCSSVars__ = () => {
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_vm.color),
|
||||
\\"xxxxxxxx-font_size\\": (_vm.font.size)
|
||||
"xxxxxxxx-color": (_vm.color),
|
||||
"xxxxxxxx-font_size": (_vm.font.size)
|
||||
}))}
|
||||
const __setup__ = __default__.setup
|
||||
__default__.setup = __setup__
|
||||
@ -150,9 +150,9 @@ export default {
|
||||
setup(__props) {
|
||||
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-color\\": (_setup.color),
|
||||
\\"xxxxxxxx-size\\": (_setup.size),
|
||||
\\"xxxxxxxx-foo\\": (_vm.foo)
|
||||
"xxxxxxxx-color": (_setup.color),
|
||||
"xxxxxxxx-size": (_setup.size),
|
||||
"xxxxxxxx-foo": (_vm.foo)
|
||||
}))
|
||||
|
||||
const color = 'red'
|
||||
@ -178,7 +178,7 @@ exports[`CSS vars injection > w/ normal <script> binding analysis 1`] = `
|
||||
import { useCssVars as _useCssVars } from 'vue'
|
||||
const __injectCSSVars__ = () => {
|
||||
_useCssVars((_vm, _setup) => ({
|
||||
\\"xxxxxxxx-size\\": (_vm.size)
|
||||
"xxxxxxxx-size": (_vm.size)
|
||||
}))}
|
||||
const __setup__ = __default__.setup
|
||||
__default__.setup = __setup__
|
||||
|
@ -31,21 +31,21 @@ it('should work', () => {
|
||||
var _vm = this,
|
||||
_c = _vm._self._c
|
||||
return _c(
|
||||
\\"div\\",
|
||||
{ attrs: { id: \\"app\\" } },
|
||||
"div",
|
||||
{ attrs: { id: "app" } },
|
||||
[
|
||||
_c(\\"div\\", { style: { color: _vm.color } }, [_vm._v(_vm._s(_vm.foo))]),
|
||||
_vm._v(\\" \\"),
|
||||
_c("div", { style: { color: _vm.color } }, [_vm._v(_vm._s(_vm.foo))]),
|
||||
_vm._v(" "),
|
||||
_vm._l(_vm.list, function (i) {
|
||||
return _c(\\"p\\", [_vm._v(_vm._s(i))])
|
||||
return _c("p", [_vm._v(_vm._s(i))])
|
||||
}),
|
||||
_vm._v(\\" \\"),
|
||||
_c(\\"foo\\", {
|
||||
_vm._v(" "),
|
||||
_c("foo", {
|
||||
inlineTemplate: {
|
||||
render: function () {
|
||||
var _vm = this,
|
||||
_c = _vm._self._c
|
||||
return _c(\\"div\\", [_vm._v(_vm._s(_vm.bar))])
|
||||
return _c("div", [_vm._v(_vm._s(_vm.bar))])
|
||||
},
|
||||
staticRenderFns: [],
|
||||
},
|
||||
@ -81,10 +81,10 @@ it('setup bindings', () => {
|
||||
_c = _vm._self._c,
|
||||
_setup = _vm._self._setupProxy
|
||||
return _c(
|
||||
\\"div\\",
|
||||
"div",
|
||||
{
|
||||
on: {
|
||||
click: function (\$event) {
|
||||
click: function ($event) {
|
||||
_setup.count++
|
||||
},
|
||||
},
|
||||
|
@ -116,7 +116,7 @@ describe('Global config', () => {
|
||||
expect(vm.computed).toBe('1,2,3')
|
||||
expect(vm.data).toBe('1,2,3')
|
||||
|
||||
vm.prop.push(4, 5)
|
||||
vm.prop = [...vm.prop, 4, 5]
|
||||
expect(vm.computed).toBe('1,2,3,4,5')
|
||||
expect(vm.data).toBe('1,2,3,4,5')
|
||||
Vue.config.async = true
|
||||
|
Loading…
Reference in New Issue
Block a user