3

How do you test a button's disabled attribute changing in vue test utils? The disabled attribute of the button depends on isFormValid and isFormModified. I've tried setting them to both true in my test, but it still receives a false.

Component

 <v-btn
   data-qa="reviewData"
   @click="validateForm()"
   :disabled="!(isFormValid && isFormModified)"
   :color="primaryColor"
   rounded
   class="font-weight-regular text-none white--text px-7 mr-8 mt-3"
 >
   { $t('accountMaintenance.review') }}</v-btn

Test

wrapper.setData({ isFormModified: true, isFormValid: true })
const button = wrapper.find('[data-qa="reviewData"]')
expect(button.attributes().disabled).toBe('false')
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.