-
Notifications
You must be signed in to change notification settings - Fork 279
-
Hi,
I am building a component, and from a user-facing perspective this components serves as a whole unit, so I want to assert exactly that. That when this component is read by screen readers it is read as 1 unit.
As a result I want to write a test to make sure that the rendered component has only 1 accessible element.
One idea I had is to get all accessible elements and make sure that the count is 1, but I am not sure how to do that. Can someone help me?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
As far as I can think, there is no way to achieve that now
Beta Was this translation helpful? Give feedback.
All reactions
-
What do you think of this
expect(screen.queryAllByRole(/.+/)).toHaveLength(1);
Beta Was this translation helpful? Give feedback.
All reactions
-
Hmmm, there is a chance it might actually work. You would need to do some testing
Beta Was this translation helpful? Give feedback.
All reactions
-
Hmmm, there is a chance it might actually work. You would need to do some testing
Beta Was this translation helpful? Give feedback.