-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Description
🚀 Feature Request
Is it possible to add more input control state assertions?
In the kit there's already toBeDisabled() and toBeEditable(), but all others that are defined in the element state are missing. I am talking about :invalid :valid, :required, etc.
There are currently ways to check for states manually, which I have to do right now (using Angular specifically) toHaveClass('ng-invalid'), for example, but it would be nice if could just write toBeInvalid() instead.
Example
In Angular
Instead of this:
await expect(openingByAttorneyPage.modalFullNameControl).toHaveClass('ng-invalid');
Have this:
await expect(openingByAttorneyPage.modalFullNameControl).toBeInvalid();
In any other framework / UI kit you would search for something that signals that specific field to be invalid, required, etc.
Motivation
Increase readability
Less typing
Use direct browser API instead of a roundabout way of doing the same thing