generated from nl-design-system/example
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: change CounterBadge to NumberBadge (#1027)
closes #681 --------- Signed-off-by: Adham AboHasson <[email protected]>
- Loading branch information
Showing
9 changed files
with
43 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
import '@testing-library/jest-dom'; | ||
|
||
import { render, screen } from '@testing-library/react'; | ||
import { NumberBadge } from './NumberBadge'; | ||
|
||
describe('numberBadge', () => { | ||
it('renders a visible element', () => { | ||
const { container } = render(<NumberBadge />); | ||
|
||
const numberBadge = container.querySelector(':only-child'); | ||
|
||
expect(numberBadge).toBeInTheDocument(); | ||
expect(numberBadge).toBeVisible(); | ||
}); | ||
it('renders a visible element with a number', () => { | ||
render(<NumberBadge data-testid="test-id">5</NumberBadge>); | ||
expect(screen.getByTestId('test-id').textContent).toBe('5'); | ||
}); | ||
it('render value en children', () => { | ||
render( | ||
<NumberBadge data-testid="test-id" value={'5555'}> | ||
5,555 | ||
</NumberBadge>, | ||
); | ||
expect(screen.getByTestId('test-id').textContent).toBe('5,555'); | ||
expect(screen.getByTestId('test-id').getAttribute('value')).toBe('5555'); | ||
}); | ||
}); |
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,4 @@ | ||
export { | ||
BadgeCounter as NumberBadge, | ||
type BadgeCounterProps as NumberBadgeProps, | ||
} from '@utrecht/component-library-react'; |
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
2 changes: 1 addition & 1 deletion
2
.../storybook/src/community/counter-badge.md → ...s/storybook/src/community/number-badge.md
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
# Rijkshuisstijl Community Counter Badge component | ||
# Rijkshuisstijl Community Number Badge component | ||
|
||
Een counter badge is een badge die een getal toont. |
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
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
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