Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 17, 2022
1 parent f294a09 commit d130849
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/features/renderer-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ export const testMarkdownRenderer = () => {
const html = await $fetch('/features/custom-paragraph')
expect(html).contains('[Paragraph]')
})

test('override default slot', async () => {
const html = await $fetch('/features/slotted-content-renderer')
expect(html).contains('The default slot is overridden')
})
})
}
18 changes: 18 additions & 0 deletions test/fixtures/basic/pages/features/slotted-content-renderer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<main>
<ContentRenderer :value="data">
<Alert>
The default slot is overridden.
</Alert>
<ContentRendererMarkdown :value="data" />
<template #empty>
<p>No content found.</p>
</template>
</ContentRenderer>
</main>
</template>

<script setup lang="ts">
const path = '/'
const { data } = await useAsyncData(`content-${path}`, () => queryContent().where({ _path: path, draft: { $ne: true } }).findOne())
</script>

0 comments on commit d130849

Please sign in to comment.