Skip to content

Commit 75b850a

Browse files
committed
test(e2e): add test for prop import-map
1 parent 92eef3e commit 75b850a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

e2e/VuePreview.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test.describe('basic', () => {
5252
})
5353
})
5454

55-
test.describe.skip('css', () => {
55+
test.describe('css', () => {
5656
test('default style of css vars', async ({ mount }) => {
5757
const sfc = await mount(TestBasic)
5858
const vuePreviewContainer = await sfc.locator('.vue-preview__container')
@@ -132,7 +132,7 @@ test.describe.skip('css', () => {
132132
})
133133
})
134134

135-
test.describe.skip('props', () => {
135+
test.describe('props', () => {
136136
test('default props', async ({ mount }) => {
137137
const sfc = await mount(TestBasic)
138138
const iframe = await sfc.frameLocator('iframe')
@@ -150,9 +150,9 @@ test.describe.skip('props', () => {
150150

151151
// code
152152
const h1 = await iframe.locator('h1')
153-
await expect(h1).toHaveText('test props')
154-
const input = await iframe.locator('input')
155-
await expect(input).toHaveValue('test props')
153+
await expect(h1).toHaveText('Test')
154+
const span = await iframe.locator('span')
155+
await expect(span).toHaveText('true')
156156

157157
// collapse
158158
const editor = await sfc.locator('.editor')

e2e/components/Props.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ import { VuePreview } from '../../dist/index'
33
44
const code = encodeURIComponent(`
55
<script setup>
6-
import { ref } from 'vue'
6+
import { isString } from '@vue/shared'
77
8-
const msg = ref('test props')
8+
const flag = isString('@vue/shared')
99
<\/script>
1010
1111
<template>
12-
<h1>{{ msg }}</h1>
13-
<input v-model="msg">
12+
<h1>Test</h1>
13+
<span>{{flag}}</span>
1414
</template>
1515
`.trim(),
1616
)
17+
18+
const importMap = {
19+
'@vue/shared': 'https://unpkg.com/@vue/shared@latest/dist/shared.esm-bundler.js',
20+
}
1721
</script>
1822

1923
<template>
20-
<VuePreview :code="code" encode collapse :preview-body-style="{ background: 'red' }" :preview-app-style="{ background: 'yellow' }" />
24+
<VuePreview :code="code" encode collapse :preview-body-style="{ background: 'red' }" :preview-app-style="{ background: 'yellow' }" :import-map="importMap" />
2125
</template>

0 commit comments

Comments
 (0)