Skip to content

Commit

Permalink
fix(badge): fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
kikoruiz committed May 2, 2023
1 parent 7f2d59c commit 3a71a7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/components/badge/src/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getByLabelText, render, screen } from '@testing-library/react'
import { render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'

import { Badge } from './Badge'
Expand All @@ -19,8 +19,8 @@ describe('Badge', () => {
it('should has DOM content when passing a children', () => {
render(<Badge>Hello World!</Badge>)

const helloWorldContent = (content, element) => {
return element.tagName.toLowerCase() === 'div' && content.startsWith('Hello World!')
const helloWorldContent = (content: string, element: Element | null) => {
return element?.tagName.toLowerCase() === 'div' && content.startsWith('Hello World!')
}
const childrenWithText = screen.getByText(helloWorldContent)

Expand Down
4 changes: 2 additions & 2 deletions packages/components/badge/src/BadgeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export const BadgeItem = forwardRef<HTMLSpanElement, BadgeItemProps>(
) => {
const hasOverflow = count && count > overflowCount
const regularCountLabel =
count && count > 1 ? labels.pluralCount.replace('%COUNT%', count) : labels.singleCount
count && count > 1 ? labels.pluralCount?.replace('%COUNT%', `${count}`) : labels.singleCount
const countLabel = hasOverflow
? labels.moreThanOverflowCount.replace('%OVERFLOW_COUNT%', overflowCount)
? labels.moreThanOverflowCount?.replace('%OVERFLOW_COUNT%', `${overflowCount}`)
: regularCountLabel
const label = count ? countLabel : labels.noCount

Expand Down

0 comments on commit 3a71a7f

Please sign in to comment.