Skip to content

Commit

Permalink
update text test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandredev3 committed Jan 28, 2023
1 parent 0893352 commit 61770e6
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions packages/components/Text/tests/text.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,21 @@ describe("Rendering a custom Text component", () => {
});

it("should appear on the screen with the given child element as the parent element", async () => {
const { getByTestId } = render(
<div data-testid="text-container">
<Text asChild>
<p>Lorem ipsum</p>
</Text>
</div>
render(
<Text asChild>
<p>Lorem ipsum</p>
</Text>
);

expect(screen.queryByText(/Lorem ipsum/)).not.toBeNull();
expect(getByTestId("text-container")).toContainHTML(
'<p class="text-gray-100 text-md font-sans">Lorem ipsum</p>'
);
expect(getByTestId("text-container")).not.toContainHTML(
'<span class="text-gray-100 text-md font-sans"><p>Lorem ipsum</p></span>'
);
const element = screen.queryByText(/Lorem ipsum/);

expect(element).not.toBeNull();
expect(element).toMatchInlineSnapshot(`
<p
class="text-gray-100 text-md font-sans"
>
Lorem ipsum
</p>
`);
});
});

0 comments on commit 61770e6

Please sign in to comment.