|
1
|
import { render, screen } from "@testing-library/react" |
|
2
|
import * as React from "react" |
|
3
|
|
|
4
|
import { Plus } from "@medusajs/icons" |
|
5
|
import { IconButton } from "./icon-button" |
|
6
|
|
|
7
|
describe("IconButton", () => { |
|
8
|
it("renders a IconButton", () => { |
|
9
|
render( |
|
10
|
<IconButton> |
|
11
|
<Plus /> |
|
12
|
</IconButton> |
|
13
|
) |
|
14
|
const button = screen.getByRole("button") |
|
15
|
expect(button).toBeInTheDocument() |
|
16
|
}) |
|
17
|
|
|
18
|
it("renders a button as a link", () => { |
|
19
|
render( |
|
20
|
<IconButton asChild> |
|
21
|
<a href="https://www.medusajs.com"> |
|
22
|
<Plus /> |
|
23
|
</a> |
|
24
|
</IconButton> |
|
25
|
) |
|
26
|
|
|
27
|
const button = screen.getByRole("link") |
|
28
|
expect(button).toBeInTheDocument() |
|
29
|
}) |
|
30
|
}) |