File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments