vendredi 3 avril 2020

Vue utils - wrapper.find not returning properly

I'm creating some tests for my component in vue and in one of them I need to trigger a click in the element, I get an error saying that the find is not returning anything but if I console.log the variable is shows an object

 test('some test', () => {
        const wrapper = shallowMount(Component, {
            props: ComponentData
        })

        const element= wrapper.find('option') //option is a class

        option.trigger('click') // The error is given here, saying find did not return option, cannot call trigger() on empty Wrapper

        console.log(`Wrapper -- ${element}`) // Wrapper -- [object Object]

    })

Aucun commentaire:

Enregistrer un commentaire