|
| 1 | +import { expect, it } from 'vitest' |
| 2 | +import { mountSuspended } from '@nuxt/test-utils/runtime' |
| 3 | +import { ComponentWithUseRuntimeConfig, ComponentWithProse, SomeComponent, ProseH3, ProseP } from '#components' |
| 4 | + |
| 5 | +it('should render any component', async () => { |
| 6 | + const component = await mountSuspended(SomeComponent) |
| 7 | + expect(component.html()).toContain('This is an auto-imported component') |
| 8 | +}) |
| 9 | + |
| 10 | +it('should render a ProseH3 component', async () => { |
| 11 | + const headingText = 'This is a Prose Heading component' |
| 12 | + const component = await mountSuspended(ProseH3, { slots: { default: headingText } }) |
| 13 | + expect(component.html()).toContain(headingText) |
| 14 | +}) |
| 15 | + |
| 16 | +it('should render a ProseP component', async () => { |
| 17 | + const paragraphText = 'This is a Prose Paragraph component' |
| 18 | + const component = await mountSuspended(ProseP, { slots: { default: paragraphText } }) |
| 19 | + expect(component.html()).toContain(paragraphText) |
| 20 | +}) |
| 21 | + |
| 22 | +it('should render a ComponentWithUseRuntimeConfig component', async () => { |
| 23 | + const component = await mountSuspended(ComponentWithUseRuntimeConfig) |
| 24 | + expect(component.html()).toContain('Use Runtime Config') |
| 25 | +}) |
| 26 | + |
| 27 | +it('should render a ComponentWithProse component', async () => { |
| 28 | + const headingText = 'Text rendered within ProseH3' |
| 29 | + const paragraphText = 'Text rendered within p' |
| 30 | + const component = await mountSuspended(ComponentWithProse, { props: { heading: headingText, content: paragraphText } }) |
| 31 | + expect(component.html()).toContain(headingText) |
| 32 | + expect(component.html()).toContain(paragraphText) |
| 33 | +}) |
0 commit comments