Skip to content

.toHaveAttribute('disabled') and .toBeDisabled() #325

Answered by eps1lon
StefanZivkovic asked this question in Q&A

You must be logged in to vote

You want to check for the property not the attribute. The property is probably what you're actually interested in unless you need [disabled="true"] CSS selectors which could be replaced with :disabled:

-expect(readyToEsignButton).toHaveAttribute('disabled', 'true'); 
+expect(readyToEsignButton).toHaveProperty('disabled', true); 

Replies: 3 comments 4 replies

You must be logged in to vote
1 reply
@StefanZivkovic

You must be logged in to vote
3 replies
@StefanZivkovic

@shubhvj

@jesse-gc

Answer selected by nickserv

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants