Open
Description
Describe the feature you'd like:
Expose all the computeAriaXXX
functions from role-helpers to provide greater flexibility for test authoring. This would enable writing tests like this:
const optionsList = within(getByRole(document.body, 'listbox', { name: /Options list/ }));
expect(
optionsList.queryAllByRole('option').map(e => ({
name: computeAccessibleName(e),
selected: computeAriaSelected(e),
}))
).toEqual([
{ name: 'manager1', selected: true },
{ name: 'external2', selected: false },
]);
Here, we combine the verification of the order and the specific ARIA properties for each option into a single expectation. Otherwise, it would require at least two steps to achieve the same result.
expect(optionsList.queryAllByRole('option').map(e => computeAccessibleName(e))).toEqual(['manager1', 'external2']);
expect(optionsList.queryByRole('option', { name: 'manager1', selected: true })).toBeDefined();
expect(optionsList.queryByRole('option', { name: 'external2', selected: false })).toBeDefined();
Metadata
Metadata
Assignees
Labels
No labels