fix(runtime-vapor): fix error when props are not provided

This commit is contained in:
zhiyuanzmj 2025-07-10 10:38:21 +08:00 committed by GitHub
parent 487d25efac
commit be7d5a6c34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 1 deletions

View File

@ -5,7 +5,26 @@ import { createComponent, defineVaporComponent } from '../src'
const define = makeInteropRender()
describe('vdomInterop', () => {
describe.todo('props', () => {})
describe('props', () => {
test('should work if props are not provided', () => {
const VaporChild = defineVaporComponent({
props: {
msg: String,
},
setup(_, { attrs }) {
return [document.createTextNode(attrs.class || 'foo')]
},
})
const { html } = define({
setup() {
return () => h(VaporChild as any)
},
}).render()
expect(html()).toBe('foo')
})
})
describe.todo('emit', () => {})