Skip to content

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

Answered by eps1lon
StefanZivkovic asked this question in Q&A
Discussion options

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

Comment options

You must be logged in to vote
1 reply
@StefanZivkovic
Comment options

Comment options

You must be logged in to vote
3 replies
@StefanZivkovic
Comment options

@shubhvj
Comment options

@jesse-gc
Comment options

Answer selected by nickserv
Comment options

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