diff --git a/src/__tests__/ariaAttributes.js b/src/__tests__/ariaAttributes.js new file mode 100644 index 00000000..56590aac --- /dev/null +++ b/src/__tests__/ariaAttributes.js @@ -0,0 +1,85 @@ +import {render} from './helpers/test-utils' + +test('`selected` throws on unsupported roles', () => { + const {getByRole} = render(``) + expect(() => + getByRole('textbox', {selected: true}), + ).toThrowErrorMatchingInlineSnapshot( + `"\\"aria-selected\\" is not supported on role \\"textbox\\"."`, + ) +}) + +test('`selected: true` matches `aria-selected="true"` on supported roles', () => { + const {getAllByRole} = render(` + +
+
+
+
+
+
+
+
+
+
+ + + + + + + + + +
+
+ +
+
+
+
+ + +
+ +
+
+
+
+
+
+
+