fix: use two words component

This commit is contained in:
Anthony Fu 2022-11-30 08:10:46 +08:00
parent 82ca803748
commit 85081134f0
8 changed files with 10 additions and 9 deletions

View File

@ -68,6 +68,7 @@ See [Vitesse](https://github.com/antfu/vitesse) for full featureset.
- [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) - file system based routing
- [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) - Directly use Vue Composition API and others without importing
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - components auto import
- [`unplugin-vue-macros`](https://github.com/sxzz/unplugin-vue-macros) - Explore and extend more macros and syntax sugar to Vue.
- [VueUse](https://github.com/antfu/vueuse) - collection of useful composition APIs
## Try it now!

6
components.d.ts vendored
View File

@ -7,10 +7,10 @@ export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Counter: typeof import('./src/components/Counter.vue')['default']
Footer: typeof import('./src/components/Footer.vue')['default']
Input: typeof import('./src/components/Input.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
TheCounter: typeof import('./src/components/TheCounter.vue')['default']
TheFooter: typeof import('./src/components/TheFooter.vue')['default']
TheInput: typeof import('./src/components/TheInput.vue')['default']
}
}

View File

@ -1,6 +1,6 @@
<template>
<main font-sans p="x-4 y-10" text="center gray-700 dark:gray-200">
<RouterView />
<Footer />
<TheFooter />
</main>
</template>

View File

@ -26,7 +26,7 @@ const go = () => {
<div py-4 />
<Input
<TheInput
v-model="name"
placeholder="What's your name?"
autocomplete="false"

View File

@ -1,16 +1,16 @@
import { mount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'
import Counter from '../src/components/Counter.vue'
import TheCounter from '../src/components/TheCounter.vue'
describe('Counter.vue', () => {
describe('TheCounter.vue', () => {
it('should render', () => {
const wrapper = mount(Counter, { props: { initial: 10 } })
const wrapper = mount(TheCounter, { props: { initial: 10 } })
expect(wrapper.text()).toContain('10')
expect(wrapper.html()).toMatchSnapshot()
})
it('should be interactive', async () => {
const wrapper = mount(Counter, { props: { initial: 0 } })
const wrapper = mount(TheCounter, { props: { initial: 0 } })
expect(wrapper.text()).toContain('0')
expect(wrapper.find('.inc').exists()).toBe(true)