Skip to content

Commit 61234e9

Browse files
committed
chore: add test for ContentSlot
1 parent 8eda200 commit 61234e9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template>
2+
<div>
3+
<h1><ContentSlot :use="$slots.title" unwrap="p" /></h1>
4+
<ContentSlot :use="$slots.default" />
5+
</div>
6+
</template>

test/module.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,23 @@ describe('fixtures:basic', async () => {
5858
global: true
5959
})
6060
})
61+
62+
test('Test component', async () => {
63+
const component = await $fetch('/api/component-meta/TestContent')
64+
65+
expect(component).ownProperty('pascalName')
66+
expect(component).ownProperty('meta')
67+
expect(component.meta).ownProperty('props')
68+
expect(Array.isArray(component.meta.props)).toBeTruthy()
69+
expect(component.meta).ownProperty('slots')
70+
expect(Array.isArray(component.meta.slots)).toBeTruthy()
71+
72+
expect(component).toMatchObject({
73+
global: true,
74+
pascalName: 'TestContent'
75+
})
76+
expect(component.meta.slots.length).toBe(2)
77+
expect(component.meta.slots[0].name).toBe('title')
78+
expect(component.meta.slots[1].name).toBe('default')
79+
})
6180
})

0 commit comments

Comments
 (0)