fix(compiler-sfc): fix object default values for reactive props destructure

This commit is contained in:
Evan You
2022-05-10 08:39:27 +08:00
parent 0683a022ec
commit 7dfe146096
3 changed files with 9 additions and 9 deletions

View File

@@ -59,7 +59,7 @@ describe('sfc props transform', () => {
// function
expect(content).toMatch(`props: _mergeDefaults(['foo', 'bar'], {
foo: 1,
bar: () => {}
bar: () => ({})
})`)
assertCode(content)
})
@@ -74,7 +74,7 @@ describe('sfc props transform', () => {
// function
expect(content).toMatch(`props: {
foo: { type: Number, required: false, default: 1 },
bar: { type: Object, required: false, default: () => {} }
bar: { type: Object, required: false, default: () => ({}) }
}`)
assertCode(content)
})
@@ -92,11 +92,11 @@ describe('sfc props transform', () => {
// function
expect(content).toMatch(`props: {
foo: { default: 1 },
bar: { default: () => {} },
bar: { default: () => ({}) },
baz: null,
boola: { type: Boolean },
boolb: { type: [Boolean, Number] },
func: { type: Function, default: () => () => {} }
func: { type: Function, default: () => (() => {}) }
}`)
assertCode(content)
})