File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 11<script lang="ts" setup>
2- const inputValue = defineModel (' inputValue ' , {
2+ const inputValue = defineModel (' modelValue ' , {
33 type: String ,
44 default: ' ' ,
55})
Original file line number Diff line number Diff line change 1+ import { mount } from '@vue/test-utils'
2+ import { describe , expect , it } from 'vitest'
3+ import TheInput from '../src/components/TheInput.vue'
4+
5+ describe ( 'test for TheInput.vue' , ( ) => {
6+ it ( 'create and set value' , async ( ) => {
7+ const wrapper = mount ( TheInput , {
8+ props : {
9+ modelValue : 'text' ,
10+ } ,
11+ } )
12+ const element = wrapper . element as HTMLInputElement
13+ expect ( element ) . toBeTruthy ( )
14+ expect ( element . value ) . toBe ( 'text' )
15+ await wrapper . setProps ( { modelValue : 'new text' } )
16+ expect ( wrapper . find ( 'input' ) . element . value ) . toBe ( 'new text' )
17+ } )
18+ } )
You can’t perform that action at this time.
0 commit comments