]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-vapor): fix error when props are not provided
authorzhiyuanzmj <260480378@qq.com>
Thu, 10 Jul 2025 02:38:21 +0000 (10:38 +0800)
committerGitHub <noreply@github.com>
Thu, 10 Jul 2025 02:38:21 +0000 (10:38 +0800)
packages/runtime-vapor/__tests__/vdomInterop.spec.ts

index 582e67dd876fb4bf1f352adfaac45585136b2d03..dd51652550e842ef6c9a5cfd75b764a829492af3 100644 (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', () => {})