Skip to content

Commit 0fe831f

Browse files
committed
test(e2e): add vue-components cases
1 parent d776236 commit 0fe831f

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

e2e/docs/.vuepress/client.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { defineClientConfig } from 'vuepress/client'
2+
import ComponentForMarkdownGlobal from './components/ComponentForMarkdownGlobal.vue'
23
import RootComponentFromUserConfig from './components/RootComponentFromUserConfig.vue'
34

45
// static imported styles file
56
import '@vuepress-e2e/style-exports/foo.css'
67

78
export default defineClientConfig({
8-
async enhance() {
9+
async enhance({ app }) {
10+
// register global components
11+
app.component('ComponentForMarkdownGlobal', ComponentForMarkdownGlobal)
12+
913
// dynamic imported styles file
1014
await import('@vuepress-e2e/style-exports')
1115
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div class="component-for-markdown-global">
3+
<p>component for markdown global</p>
4+
</div>
5+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div class="component-for-markdown-import">
3+
<p>component for markdown import</p>
4+
</div>
5+
</template>

e2e/docs/markdown/vue-components.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ComponentForMarkdownGlobal />
2+
3+
<ComponentForMarkdownImport />
4+
5+
<script setup>
6+
// TODO: relative path import?
7+
import ComponentForMarkdownImport from '@source/.vuepress/components/ComponentForMarkdownImport.vue';
8+
</script>
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
test('should render vue components correctly', async ({ page }) => {
4+
await page.goto('markdown/vue-components.html')
5+
6+
await expect(page.locator('.component-for-markdown-global p')).toHaveText(
7+
'component for markdown global',
8+
)
9+
await expect(page.locator('.component-for-markdown-import p')).toHaveText(
10+
'component for markdown import',
11+
)
12+
})

0 commit comments

Comments
 (0)