Update test
This commit is contained in:
parent
8a4994e75c
commit
9abcc06b64
@ -1,55 +0,0 @@
|
||||
<!-- <script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'IndexPage',
|
||||
})
|
||||
const name = $ref(user.savedName)
|
||||
|
||||
const router = useRouter()
|
||||
const go = () => {
|
||||
if (name)
|
||||
router.push(`/hi/${encodeURIComponent(name)}`)
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div text-4xl>
|
||||
<div i-carbon-campsite inline-block />
|
||||
</div>
|
||||
<p>
|
||||
<a rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank">
|
||||
Vitesse
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<em text-sm opacity-75>{{ t('intro.desc') }}</em>
|
||||
</p>
|
||||
|
||||
<div py-4 />
|
||||
|
||||
<TheInput
|
||||
v-model="name"
|
||||
placeholder="What's your name?"
|
||||
autocomplete="false"
|
||||
@keydown.enter="go"
|
||||
/>
|
||||
<label class="hidden" for="input">{{ t('intro.whats-your-name') }}</label>
|
||||
|
||||
<div>
|
||||
<button
|
||||
btn m-3 text-sm
|
||||
:disabled="!name"
|
||||
@click="go"
|
||||
>
|
||||
{{ t('button.go') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<route lang="yaml">
|
||||
meta:
|
||||
layout: home
|
||||
</route> -->
|
@ -1,3 +0,0 @@
|
||||
// Vitest Snapshot v1
|
||||
|
||||
exports[`TheCounter.vue > should render 1`] = `"<div>10 <button class=\\"inc\\"> + </button><button class=\\"dec\\"> - </button></div>"`;
|
@ -1,28 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import TheCounter from '../src/components/TheCounter.vue'
|
||||
|
||||
describe('TheCounter.vue', () => {
|
||||
it('should render', () => {
|
||||
const wrapper = mount(TheCounter, { props: { initial: 10 } })
|
||||
expect(wrapper.text()).toContain('10')
|
||||
expect(wrapper.html()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should be interactive', async () => {
|
||||
const wrapper = mount(TheCounter, { props: { initial: 0 } })
|
||||
expect(wrapper.text()).toContain('0')
|
||||
|
||||
expect(wrapper.find('.inc').exists()).toBe(true)
|
||||
|
||||
expect(wrapper.find('.dec').exists()).toBe(true)
|
||||
|
||||
await wrapper.get('.inc').trigger('click')
|
||||
|
||||
expect(wrapper.text()).toContain('1')
|
||||
|
||||
await wrapper.get('.dec').trigger('click')
|
||||
|
||||
expect(wrapper.text()).toContain('0')
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user