Skip to content

Support menuitemcheckbox/menuitemradio roles in toBeChecked #266

@tf

Description

@tf

Describe the feature you'd like:

According to the spec menuitemcheckbox and menuitemradio both require aria-checked attributes.

I think it would be nice to be able to write:

expect(getByRole('menuitemradio', {name: 'Some option'})).toBeChecked();

Suggested implementation:

Add menuitemcheckbox and menuitemradio to the allowed roles in the matcher.

Describe alternatives you've considered:

So far, I was only able to use low level matchers like toHaveAttribute('aria-checked', 'true').

Teachability, Documentation, Adoption, Migration Strategy:

The roles would need to be added to list of allowed roles mentioned in the readme and the error messages.

Happy to prepare a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions