Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchangtao committed Oct 17, 2024
1 parent e91eebe commit 41e10dc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/runtime-core/__tests__/componentSlots.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,32 @@ describe('component: slots', () => {
'Slot "default" invoked outside of the render function',
).not.toHaveBeenWarned()
})

test('should not warn when render in setup', () => {
const container = {
setup(_: any, { slots }: any) {
return function () {
return slots.default && slots.default()
}
},
}

const comp = h(container, null, {
default() {
return () => h('div')
},
})

const App = {
setup() {
render(h(comp), nodeOps.createElement('div'))
return () => null
},
}

createApp(App).mount(nodeOps.createElement('div'))
expect(
'Slot "default" invoked outside of the render function',
).not.toHaveBeenWarned()
})
})

0 comments on commit 41e10dc

Please sign in to comment.