-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: badge should render children 0 value (#6981)
When passing 0 in as child, the 0 was not rendred. Fixed the badge component and added tests. ![image](https://github.com/Unleash/unleash/assets/964450/d681b70c-5d55-4818-86ea-7d05fa86c7b3)
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { Badge } from './Badge'; | ||
import { render } from '../../../utils/testRenderer'; | ||
|
||
test('Badge should render text', async () => { | ||
render(<Badge color='success'>Predefined</Badge>); | ||
|
||
const result = await screen.findByText('Predefined'); | ||
expect(result).toBeInTheDocument(); | ||
}); | ||
|
||
test('Badge should children number 0', async () => { | ||
render(<Badge color='success'>{0}</Badge>); | ||
|
||
const result = await screen.findByText('0'); | ||
expect(result).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters