Skip to content

Instantly share code, notes, and snippets.

@paigen11
Created March 28, 2020 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paigen11/31204d763943df6bccc7dad88502582b to your computer and use it in GitHub Desktop.
Save paigen11/31204d763943df6bccc7dad88502582b to your computer and use it in GitHub Desktop.
Example of using parentElement to access a DOM element a level above the targeted element in React Testing Library.
const input = component.queryByPlaceholderText(componentText);
const enter = input.parentElement.querySelector('.anticon-plus');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment