chore: run updated prettier
This commit is contained in:
@@ -61,11 +61,7 @@ describe('compiler: codegen', () => {
|
||||
})
|
||||
const { code } = generate(root, { mode: 'module' })
|
||||
expect(code).toMatch(
|
||||
`import { ${helperNameMap[CREATE_VNODE]} as _${
|
||||
helperNameMap[CREATE_VNODE]
|
||||
}, ${helperNameMap[RESOLVE_DIRECTIVE]} as _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
} } from "vue"`
|
||||
`import { ${helperNameMap[CREATE_VNODE]} as _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]} as _${helperNameMap[RESOLVE_DIRECTIVE]} } from "vue"`
|
||||
)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
@@ -76,16 +72,10 @@ describe('compiler: codegen', () => {
|
||||
})
|
||||
const { code } = generate(root, { mode: 'module', optimizeImports: true })
|
||||
expect(code).toMatch(
|
||||
`import { ${helperNameMap[CREATE_VNODE]}, ${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
} } from "vue"`
|
||||
`import { ${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]} } from "vue"`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _${helperNameMap[CREATE_VNODE]} = ${
|
||||
helperNameMap[CREATE_VNODE]
|
||||
}, _${helperNameMap[RESOLVE_DIRECTIVE]} = ${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
}`
|
||||
`const _${helperNameMap[CREATE_VNODE]} = ${helperNameMap[CREATE_VNODE]}, _${helperNameMap[RESOLVE_DIRECTIVE]} = ${helperNameMap[RESOLVE_DIRECTIVE]}`
|
||||
)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
@@ -97,11 +87,7 @@ describe('compiler: codegen', () => {
|
||||
const { code } = generate(root, { mode: 'function' })
|
||||
expect(code).toMatch(`const _Vue = Vue`)
|
||||
expect(code).toMatch(
|
||||
`const { ${helperNameMap[CREATE_VNODE]}: _${
|
||||
helperNameMap[CREATE_VNODE]
|
||||
}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
} } = _Vue`
|
||||
`const { ${helperNameMap[CREATE_VNODE]}: _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${helperNameMap[RESOLVE_DIRECTIVE]} } = _Vue`
|
||||
)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
@@ -116,11 +102,7 @@ describe('compiler: codegen', () => {
|
||||
})
|
||||
expect(code).not.toMatch(`const _Vue = Vue`)
|
||||
expect(code).toMatch(
|
||||
`const { ${helperNameMap[CREATE_VNODE]}: _${
|
||||
helperNameMap[CREATE_VNODE]
|
||||
}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
} } = Vue`
|
||||
`const { ${helperNameMap[CREATE_VNODE]}: _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${helperNameMap[RESOLVE_DIRECTIVE]} } = Vue`
|
||||
)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
@@ -136,30 +118,20 @@ describe('compiler: codegen', () => {
|
||||
`const _component_Foo = _${helperNameMap[RESOLVE_COMPONENT]}("Foo")\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _component_bar_baz = _${
|
||||
helperNameMap[RESOLVE_COMPONENT]
|
||||
}("bar-baz")\n`
|
||||
`const _component_bar_baz = _${helperNameMap[RESOLVE_COMPONENT]}("bar-baz")\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _component_barbaz = _${
|
||||
helperNameMap[RESOLVE_COMPONENT]
|
||||
}("barbaz")\n`
|
||||
`const _component_barbaz = _${helperNameMap[RESOLVE_COMPONENT]}("barbaz")\n`
|
||||
)
|
||||
// implicit self reference from SFC filename
|
||||
expect(code).toMatch(
|
||||
`const _component_Qux = _${
|
||||
helperNameMap[RESOLVE_COMPONENT]
|
||||
}("Qux", true)\n`
|
||||
`const _component_Qux = _${helperNameMap[RESOLVE_COMPONENT]}("Qux", true)\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _directive_my_dir_0 = _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
}("my_dir_0")\n`
|
||||
`const _directive_my_dir_0 = _${helperNameMap[RESOLVE_DIRECTIVE]}("my_dir_0")\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _directive_my_dir_1 = _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
}("my_dir_1")\n`
|
||||
`const _directive_my_dir_1 = _${helperNameMap[RESOLVE_DIRECTIVE]}("my_dir_1")\n`
|
||||
)
|
||||
expect(code).toMatch(`let _temp0, _temp1, _temp2`)
|
||||
expect(code).toMatchSnapshot()
|
||||
|
||||
@@ -2871,7 +2871,7 @@ foo
|
||||
]
|
||||
}
|
||||
|
||||
for (const key of Object.keys(patterns) as (keyof (typeof patterns))[]) {
|
||||
for (const key of Object.keys(patterns) as (keyof typeof patterns)[]) {
|
||||
describe(key, () => {
|
||||
for (const { code, errors, options } of patterns[key]) {
|
||||
test(
|
||||
|
||||
@@ -355,8 +355,9 @@ describe('compiler: hoistStatic transform', () => {
|
||||
},
|
||||
hoistedChildrenArrayMatcher(2)
|
||||
])
|
||||
const forBlockCodegen = ((root.children[0] as ElementNode)
|
||||
.children[0] as ForNode).codegenNode
|
||||
const forBlockCodegen = (
|
||||
(root.children[0] as ElementNode).children[0] as ForNode
|
||||
).codegenNode
|
||||
expect(forBlockCodegen).toMatchObject({
|
||||
type: NodeTypes.VNODE_CALL,
|
||||
tag: FRAGMENT,
|
||||
|
||||
@@ -654,8 +654,8 @@ describe('compiler: v-for', () => {
|
||||
patchFlag: !disableTracking
|
||||
? genFlagText(PatchFlags.STABLE_FRAGMENT)
|
||||
: keyed
|
||||
? genFlagText(PatchFlags.KEYED_FRAGMENT)
|
||||
: genFlagText(PatchFlags.UNKEYED_FRAGMENT),
|
||||
? genFlagText(PatchFlags.KEYED_FRAGMENT)
|
||||
: genFlagText(PatchFlags.UNKEYED_FRAGMENT),
|
||||
children: {
|
||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||
callee: RENDER_LIST,
|
||||
|
||||
@@ -290,8 +290,8 @@ describe('compiler: transform v-model', () => {
|
||||
test('with dynamic argument', () => {
|
||||
const root = parseWithVModel('<input v-model:[value]="model" />')
|
||||
const node = root.children[0] as ElementNode
|
||||
const props = ((node.codegenNode as VNodeCall)
|
||||
.props as unknown) as CallExpression
|
||||
const props = (node.codegenNode as VNodeCall)
|
||||
.props as unknown as CallExpression
|
||||
|
||||
expect(props).toMatchObject({
|
||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||
@@ -344,8 +344,8 @@ describe('compiler: transform v-model', () => {
|
||||
prefixIdentifiers: true
|
||||
})
|
||||
const node = root.children[0] as ElementNode
|
||||
const props = ((node.codegenNode as VNodeCall)
|
||||
.props as unknown) as CallExpression
|
||||
const props = (node.codegenNode as VNodeCall)
|
||||
.props as unknown as CallExpression
|
||||
|
||||
expect(props).toMatchObject({
|
||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||
@@ -417,8 +417,9 @@ describe('compiler: transform v-model', () => {
|
||||
}
|
||||
)
|
||||
expect(root.cached).toBe(0)
|
||||
const codegen = ((root.children[0] as ForNode)
|
||||
.children[0] as PlainElementNode).codegenNode as VNodeCall
|
||||
const codegen = (
|
||||
(root.children[0] as ForNode).children[0] as PlainElementNode
|
||||
).codegenNode as VNodeCall
|
||||
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
|
||||
expect(
|
||||
(codegen.props as ObjectExpression).properties[1].value.type
|
||||
@@ -426,13 +427,10 @@ describe('compiler: transform v-model', () => {
|
||||
})
|
||||
|
||||
test('should not cache update handler if it inside v-once', () => {
|
||||
const root = parseWithVModel(
|
||||
'<div v-once><input v-model="foo" /></div>',
|
||||
{
|
||||
prefixIdentifiers: true,
|
||||
cacheHandlers: true
|
||||
}
|
||||
)
|
||||
const root = parseWithVModel('<div v-once><input v-model="foo" /></div>', {
|
||||
prefixIdentifiers: true,
|
||||
cacheHandlers: true
|
||||
})
|
||||
expect(root.cached).not.toBe(2)
|
||||
expect(root.cached).toBe(1)
|
||||
})
|
||||
@@ -444,8 +442,9 @@ describe('compiler: transform v-model', () => {
|
||||
prefixIdentifiers: true
|
||||
}
|
||||
)
|
||||
const codegen = ((root.children[0] as ComponentNode)
|
||||
.children[0] as PlainElementNode).codegenNode as VNodeCall
|
||||
const codegen = (
|
||||
(root.children[0] as ComponentNode).children[0] as PlainElementNode
|
||||
).codegenNode as VNodeCall
|
||||
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
|
||||
})
|
||||
|
||||
|
||||
@@ -531,10 +531,13 @@ describe('compiler: transform v-on', () => {
|
||||
})
|
||||
|
||||
test('should not be cached inside v-once', () => {
|
||||
const { root } = parseWithVOn(`<div v-once><div v-on:click="foo"/></div>`, {
|
||||
prefixIdentifiers: true,
|
||||
cacheHandlers: true
|
||||
})
|
||||
const { root } = parseWithVOn(
|
||||
`<div v-once><div v-on:click="foo"/></div>`,
|
||||
{
|
||||
prefixIdentifiers: true,
|
||||
cacheHandlers: true
|
||||
}
|
||||
)
|
||||
expect(root.cached).not.toBe(2)
|
||||
expect(root.cached).toBe(1)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user