Please, help with two-way binding test for QInput (Quasar 16, Jest, Vue)



  • Guys, can you, please advise what could be done here.

    I have the following component I’d like to test (not as shallow)

    0_1531906167328_5bd886eb-3b71-4a3c-bd82-78856a95eb4b-image.png

    I wanted to perform here the following tests:

    • verify the event is emitted when I set the this.selectedValue (so to tests watcher)
    • verify that this.selectedValue is changed to the value entered in embedded Qinput - as if some user enters something and manipulates the v-model.

    I managed to write the first one but I’m really struggling with the second one.

    0_1531906422643_1e95356c-e47d-4b91-9c35-168aaa603765-image.png

    I triggered a lot of different events but vm.vm.selectedValue just remained as it was recieved from props.

    Can you please, give any insights how to see the selectedValue finally changed? (I also tried $nextTick but no luck)

    Thank you in advance!



  • Sorry, the implementation of ‘@vue/test-utils’ specifies.
    input.element.value = 'other’
    input.trigger(‘input’)

    This seems to work.