fix(ct): support components w/o mount options (#15501)

This commit is contained in:
Pavel Feldman 2022-07-09 10:22:49 -08:00 committed by GitHub
parent 2e331715ff
commit dd0eb5fb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -76,7 +76,7 @@ export const fixtures: Fixtures<
}, },
}; };
async function innerMount(page: Page, jsxOrType: JsxComponent | string, options?: ObjectComponentOptions): Promise<string> { async function innerMount(page: Page, jsxOrType: JsxComponent | string, options: ObjectComponentOptions = {}): Promise<string> {
let component: Component; let component: Component;
if (typeof jsxOrType === 'string') if (typeof jsxOrType === 'string')
component = { kind: 'object', type: jsxOrType, options }; component = { kind: 'object', type: jsxOrType, options };

View File

@ -0,0 +1,3 @@
<template>
<div>test</div>
</template>

View File

@ -3,6 +3,7 @@ import { test, expect } from '@playwright/experimental-ct-vue'
import Button from './components/Button.vue' import Button from './components/Button.vue'
import DefaultSlot from './components/DefaultSlot.vue' import DefaultSlot from './components/DefaultSlot.vue'
import NamedSlots from './components/NamedSlots.vue' import NamedSlots from './components/NamedSlots.vue'
import Component from './components/Component.vue'
test.use({ viewport: { width: 500, height: 500 } }) test.use({ viewport: { width: 500, height: 500 } })
@ -60,3 +61,8 @@ test('named slots should work', async ({ mount }) => {
await expect(component).toContainText('Main Content') await expect(component).toContainText('Main Content')
await expect(component).toContainText('Footer') await expect(component).toContainText('Footer')
}) })
test('optionless should work', async ({ mount }) => {
const component = await mount(Component)
await expect(component).toContainText('test')
})