Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Nov 8, 2024
1 parent 975f081 commit 22ace47
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ function ListFormat(localProps: ListFormatProps) {
return [valueToUse]
}

if (!Array.isArray(valueToUse)) {
return [valueToUse]
}

return isListVariant
? React.Children.map(valueToUse, (child: React.ReactNode, index) => {
return <Li key={index}>{child}</Li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,6 @@ describe('ListFormat', () => {
expect(list('ul')).toContainHTML(
'<li class="dnb-li">123</li><li class="dnb-li">456</li><li class="dnb-li">789</li>'
)

rerender(
<ListFormat
variant="ul"
listType="unstyled"
value={[123, 456, 789]}
/>
)
expect(list('ul')).not.toHaveAttribute('type')
expect(list('ul')).toHaveClass('dnb-unstyled-list dnb-ul')
expect(list('ul')).toContainHTML(
'<li class="dnb-li">123</li><li class="dnb-li">456</li><li class="dnb-li">789</li>'
)
})

it('should render different `listTypes` using children', () => {
Expand Down

0 comments on commit 22ace47

Please sign in to comment.