Skip to content

Commit 4f3f503

Browse files
committedDec 5, 2024··
test: add test case for mountSuspended + #imports
#871
1 parent 094acb2 commit 4f3f503

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<span>{{ message }}</span>
3+
</template>
4+
5+
<script setup>
6+
import { useRouter } from '#imports'
7+
8+
const message = useRouter() ? 'should work with #imports' : 'failed'
9+
</script>

‎examples/app-vitest-full/tests/nuxt/mount-suspended.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ExportDefaultReturnsRenderComponent from '~/components/ExportDefaultRetur
1616
import OptionsApiPage from '~/pages/other/options-api.vue'
1717
import ComponentWithReservedProp from '~/components/ComponentWithReservedProp.vue'
1818
import ComponentWithReservedState from '~/components/ComponentWithReservedState.vue'
19+
import ComponentWithImports from '~/components/ComponentWithImports.vue'
1920

2021
import { BoundAttrs } from '#components'
2122
import DirectiveComponent from '~/components/DirectiveComponent.vue'
@@ -38,6 +39,12 @@ describe('mountSuspended', () => {
3839
`)
3940
})
4041

42+
it('should work with #imports', async () => {
43+
const comp = await mountSuspended(ComponentWithImports)
44+
const span = comp.find('span')
45+
expect(span.text()).toBe('should work with #imports')
46+
})
47+
4148
it('should handle passing setup state and props to template', async () => {
4249
const wrappedComponent = await mountSuspended(BoundAttrs)
4350
const component = mount(BoundAttrs)

0 commit comments

Comments
 (0)
Please sign in to comment.