Closed lolobosse closed 3 years ago
Given the following tests:
it("renders properly", async () => { const element = await fixture(<Tooltip content={"Hello Tooltip"} child={(toggle) => <div>Click Here</div>} />); expect(element).toMatchSnapshot(); }); it("reacts properly to click", async () => { const element = await fixture( <Tooltip content={"Hello Tooltip"} child={(toggle) => <div onClick={toggle}>Click Here</div>} />, ); fireEvent.click(getByText(element, "Click Here")); await findByText(element.parentNode as HTMLElement, "Hello Tooltip"); expect(element.parentNode).toMatchSnapshot(); });
The element.parentNode gets different id for the tooltip (tippy-1 or tippy-2).
element.parentNode
Is there a way to reset the tooltip id between each unit test to be able to run every unit test independently ?
The id is autoincrementing so I don't think so. Can snapshots be replaced with other comparisons of the element?
I've enabled Discussions for all questions to go inside instead of Issues.
Given the following tests:
The
element.parentNode
gets different id for the tooltip (tippy-1 or tippy-2).Is there a way to reset the tooltip id between each unit test to be able to run every unit test independently ?