Skip to content

Commit d380fc3

Browse files
committed
add test for problem
1 parent 56724a5 commit d380fc3

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from "react";
2+
import { render } from "@testing-library/react";
3+
4+
import "@testing-library/jest-dom";
5+
6+
import { IconButton } from "../../../index";
7+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
8+
9+
describe("Badge", () => {
10+
it("should render badge markup with correct content when used on an icon button", () => {
11+
const { container } = render(<IconButton name="item-info" badge={"badge content"} />);
12+
const badge = container.querySelector(`.${eccgui}-badge`);
13+
expect(badge).not.toBeNull();
14+
expect(badge).toHaveTextContent("badge content");
15+
});
16+
it("should render badge markup with correct content when batch displays a 0 (zero) number on an icon button", () => {
17+
const { container } = render(<IconButton name="item-info" badge={0} />);
18+
const badge = container.querySelector(`.${eccgui}-badge`);
19+
expect(badge).not.toBeNull();
20+
expect(badge).toHaveTextContent("0");
21+
});
22+
});

0 commit comments

Comments
 (0)