-
Notifications
You must be signed in to change notification settings - Fork 467
Open
Labels
bugSomething isn't workingSomething isn't working
Description
@testing-library/reactversion: 11.2.7- Testing Framework and version:
jest26x || 27x - DOM Environment: 'jsdom'
16.x
Relevant code or config:
Source: https://testing-library.com/docs/queries/bytitle/
const Test = () => (
<>
<span title="Delete" id="2"></span>
<svg>
<title>Close</title>
<g><path /></g>
</svg>
</>
);VS
const Test = () => (
<>
<span title="Delete" id="2"></span>
<svg>
<g>
<path>
<title>Close</title>
</path>
</g>
</svg>
</>
);What you did:
render(<Test/>);
screen.getByTitle('Close');What happened:
First Component - ✅
Second Component - ❌
TestingLibraryElementError: Unable to find an element with the title: Close.
Problem description:
Testing library cannot find Close because it's not a direct child of svg.
Suggested solution:
I should be able to find Close even if it's not a direct child of svg.
lindapaiste and glebhusky
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working