Skip to content

Commit

Permalink
test: add failing test for exposed methods on components within suspense
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Dec 5, 2023
1 parent 33651af commit a4ec3f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/app-vitest-full/components/WrapperTests.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ function testExpose () {
const modelValue = defineModel({ default: false })
defineExpose({
testExpose
testExpose,
someRef: ref('thing')
})
</script>

Expand Down
7 changes: 7 additions & 0 deletions examples/app-vitest-full/tests/nuxt/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ describe('test utils', () => {
expect(component.emitted()).toHaveProperty('update:modelValue')
})

// TODO: fix this failing test
it.todo('can access exposed methods/refs from components mounted within nuxt suspense', async () => {
const component = await mountSuspended(WrapperTests)
expect(component.vm.testExpose?.()).toBe('thing')
expect(component.vm.someRef).toBe('thing')
})

it('can mock fetch requests', async () => {
registerEndpoint('https://jsonplaceholder.typicode.com/todos/1', () => ({
title: 'title from mocked api',
Expand Down

0 comments on commit a4ec3f8

Please sign in to comment.