-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Description
dom-testing-library
version: latestreact
version: latestnode
version: n/anpm
(oryarn
) version: n/a
Relevant code or config:
const MyComponent = () => (
<div>
<svg aria-labelledby="tacos" />
<div id="tacos">this is tacos</div>
</div>
);
What you did:
const { getByLabelText } = render(<MyComponent />);
expect(getByLabelText("tacos")).not.toBeUndefined();
What happened:
No result for element labelled by "tacos"
Reproduction:
See codesandbox: https://codesandbox.io/s/reacttestinglibrary-demo-ollox?fontsize=14
Test output:
Unable to find a label with the text of: tacos
<body>
<div>
<div>
<svg
aria-labelledby="tacos"
/>
<div
id="tacos"
>
tacos
</div>
</div>
</div>
</body>
Error: Unable to find a label with the text of: tacos
<body>
<div>
<div>
<svg
aria-labelledby="tacos"
/>
<div
id="tacos"
>
tacos
</div>
</div>
</div>
</body>
Problem description:
There's no way to find an SVG element that is using aria-labelledby, though the labelText documentation indicates that this should work.
Suggested solution:
Metadata
Metadata
Assignees
Labels
No labels