Skip to content

Instantly share code, notes, and snippets.

@lkopacz
Created December 4, 2019 17:25
Show Gist options
  • Save lkopacz/c1ec3ff2c85fe80dd7973666007c305a to your computer and use it in GitHub Desktop.
Save lkopacz/c1ec3ff2c85fe80dd7973666007c305a to your computer and use it in GitHub Desktop.
using within
import { render, within } from "@testing-library/react";
it("testing things", () => {
const { container } = render(
<Component prop={someProp} />
);
const { getByText } = within(container.querySelector(".some-class"));
const getParent = getByText("2010").parentElement;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment