test(ct): vue2 cli (#16693)

This commit is contained in:
sand4rt 2022-08-27 00:47:28 +02:00 committed by GitHub
parent fea8772d95
commit c3f39faefc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 7 deletions

View file

@ -1,7 +1,5 @@
<template>
<button @click='$emit("submit", "hello")'>
{{ title }}
</button>
<button @click="$emit('submit', 'hello')">{{ title }}</button>
</template>
<script>

View file

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

View file

@ -3,7 +3,6 @@
<header>
<slot name="header" />
</header>
<main>
<slot name="main" />
</main>

View file

@ -7,7 +7,7 @@ import NamedSlots from './components/NamedSlots.vue'
test.use({ viewport: { width: 500, height: 500 } })
test('props should work', async ({ mount }) => {
const component = await mount(<Button title='Submit'></Button>)
const component = await mount(<Button title="Submit" />)
await expect(component).toContainText('Submit')
})
@ -78,7 +78,7 @@ test('slot should emit events', async ({ mount }) => {
test('should run hooks', async ({ page, mount }) => {
const messages = []
page.on('console', m => messages.push(m.text()))
await mount(<Button title='Submit'></Button>, {
await mount(<Button title="Submit" />, {
hooksConfig: { route: 'A' }
})
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount el: HTMLButtonElement'])

View file

@ -1,9 +1,9 @@
import { test, expect } from '@playwright/experimental-ct-vue2'
import Button from './components/Button.vue'
import Counter from './components/Counter.vue'
import DefaultSlot from './components/DefaultSlot.vue'
import NamedSlots from './components/NamedSlots.vue'
import Component from './components/Component.vue'
test.use({ viewport: { width: 500, height: 500 } })
@ -79,6 +79,11 @@ test('named slots should work', async ({ mount }) => {
await expect(component).toContainText('Footer')
})
test('optionless should work', async ({ mount }) => {
const component = await mount(Component)
await expect(component).toContainText('test')
})
test('should run hooks', async ({ page, mount }) => {
const messages = []
page.on('console', m => messages.push(m.text()))