Skip to content

Commit e1c5980

Browse files
committed
test: add more cases
1 parent a5acb4a commit e1c5980

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/runtime-vapor/__tests__/component.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,26 @@ describe('component', () => {
281281
expect(host.innerHTML).toBe('')
282282
expect(i.scope.effects.length).toBe(0)
283283
})
284+
285+
it('warn if functional vapor component not return a block', () => {
286+
define(() => {
287+
return () => {}
288+
}).render()
289+
290+
expect(
291+
'Functional vapor component must return a block directly',
292+
).toHaveBeenWarned()
293+
})
294+
295+
it('warn if setup return a function and no render function', () => {
296+
define({
297+
setup() {
298+
return () => []
299+
},
300+
}).render()
301+
302+
expect(
303+
'Vapor component setup() returned non-block value, and has no render function',
304+
).toHaveBeenWarned()
305+
})
284306
})

0 commit comments

Comments
 (0)