Skip to content

[Feature]: Support for more native input state assertions #38389

@eltaro

Description

@eltaro

🚀 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions