Testing: wrapper.setValue() cannot be called on this element
-
I can not assign a value to the q-input component when using jest
//test.js import { mountQuasar } from '~/test/jest/utils' import PAGE from '../demo/QBtn-demo.vue' const wrapper = mountQuasar(PAGE) describe('Banco Page', () => { it ('Cadastro novo banco', () => { const inputCodigo = wrapper.find({ ref: 'codigo' }) inputCodigo.setValue('bar') expect(wrapper.vm.codigo).toBe('bar') }) })
// QBtn-demo.vue <template> <q-page> <!--<input v-model="codigo" ref="codigo"/>--> <q-input v-model="codigo" ref="codigo"></q-input> </q-page> </template> <script> export default { name: 'PAGE', data () { return { codigo: '' } }, methods: { } }
I’m getting the following error:
[vue-test-utils]: wrapper.setValue() cannot be called on this element however
if I remove <q-input> and only use <input /> works perfectly.Do I need to do something different to assign value to a quasar input ?