Raw
1 import { render, screen } from "@testing-library/react"
2 import * as React from "react"
3
4 import { Text } from "./text"
5
6 describe("Text", () => {
7 it("renders a text", () => {
8 render(<Text>I am a paragraph</Text>)
9
10 const text = screen.getByText("I am a paragraph")
11 expect(text).toBeInTheDocument()
12 expect(text.tagName).toBe("P")
13 })
14
15 it("renders a text as a child", () => {
16 render(
17 <Text asChild>
18 <span>I am a span</span>
19 </Text>
20 )
21
22 const text = screen.getByText("I am a span")
23 expect(text).toBeInTheDocument()
24 expect(text.tagName).toBe("SPAN")
25 })
26 })