You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to test the correct bindings of the v-model and encountered the following problem: changing the values of the 'input' elements and calling the .trigger('input') method always only triggers the first one.
So first assert pass, seconds fails.
it('should render correct contents',()=>{constwrapper=mount(Login,{ store })expect(wrapper.find('h1')[0].text()).to.equal('Login')constusername=wrapper.find('input')[0]constpassword=wrapper.find('input')[1]username.element.value='[email protected]'password.element.value='test password'username.trigger('input')expect(wrapper.vm.credentials.username).to.equal('[email protected]')password.trigger('input')expect(wrapper.vm.credentials.password).to.equal('test password')})
Problem was solved by reorganizing of variables declarations.
In the code below all assertions pass.
it('should render correct contents',()=>{constwrapper=mount(Login,{ store })expect(wrapper.find('h1')[0].text()).to.equal('Login')constusername=wrapper.find('input')[0]username.element.value='[email protected]'username.trigger('input')constpassword=wrapper.find('input')[1]password.element.value='test password'password.trigger('input')expect(wrapper.vm.credentials.username).to.equal('[email protected]')expect(wrapper.vm.credentials.password).to.equal('test password')})
The text was updated successfully, but these errors were encountered:
I don't think there's an easy solution to this, apart from restructuring the test. Like you did. I'll leave this issue open and I can look into it in the future, but for the moment your rewrite is the best solution.
I tried to test the correct bindings of the v-model and encountered the following problem: changing the values of the 'input' elements and calling the .trigger('input') method always only triggers the first one.
So first assert pass, seconds fails.
Problem was solved by reorganizing of variables declarations.
In the code below all assertions pass.
The text was updated successfully, but these errors were encountered: