Nicholas Boll
Nicholas Boll
I also like to separate selectors from assertions for specifications. It helps understand failures: ```html 1 ``` ```js expect(getByText('1')).toHaveAttribute('aria-label', 'Page 1') // example failures // * No element: // Error:...
Note, after we've established a generic assertion works according to a specification, now we can move on to the specific selectors and assert something else interesting. ```js it('should have an...
Your first example is closer to what I want. I want a to start with the easiest, least abstracted implementation and then assert the more complicated, higher abstracted implementation. Your...
Agreed. You wanted to know scenarios where `*ByText` queries would be used without a role. I think `*ByRole('button', { text: 'Hello' })` would be helpful in identifying a role and...
A case where I have a button text that is different than the accessible name: ```html 1 getByText('1') // doesn't work getByRole('button', { name: '1' }) // doesn't work. `name`...
On projects I work on, we have design specifications and accessibility specifications. Product Managers, Designers, UX Engineers, QA Engineers, Developers, and Accessibility Specialists look at these specifications. All these stakeholders...
> What do you mean "unhelpfully"? The error message should include the accessible names of each element in the a11y tree. In the following example: ```html 1 ``` Let's say...
> We cannot use the same method for getting the text in ByDisplayValue, ByText and ByLabelText. That would defeat the purpose of having different methods in the first place. I'm...
I'm not suggesting using styling to detect rasterized pixels on the screen. It kind of sounds like you want to remove `ByText` instead of fixing some of the unexpected edge...
> > Let's say somehow the "Page 1" aria label is removed > > We want to fail here. The accessible text and therefore the element semantics changed. Obviously it...