Skip to content

Commit

Permalink
add test for nested Flex.Container spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
joakbjerk committed May 16, 2024
1 parent 0246fe8 commit 021513c
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,35 @@ describe('Flex.Container', () => {
})
})

it('should support spacing props for nested Flex.Containers', () => {
render(
<Flex.Container>
<Flex.Vertical
id="flex-container-space"
space={{
bottom: 'xx-large',
top: 'xx-large',
left: 'xx-large',
right: 'xx-large',
}}
>
<Flex.Item>FlexItem 1</Flex.Item>
<Flex.Item>FlexItem 2</Flex.Item>
<Flex.Item>FlexItem 3</Flex.Item>
<Flex.Item>FlexItem 4</Flex.Item>
</Flex.Vertical>
</Flex.Container>
)

const flexContainer = document.querySelector('#flex-container-space')
expect(flexContainer).toHaveClass(
'dnb-space__left--xx-large',
'dnb-space__right--xx-large',
'dnb-space__top--xx-large',
'dnb-space__bottom--xx-large'
)
})

it('should set custom element', () => {
render(<Flex.Container element="section">content</Flex.Container>)

Expand Down

0 comments on commit 021513c

Please sign in to comment.