Skip to content

Commit

Permalink
Align integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed May 15, 2024
1 parent e2d2f78 commit 242e915
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ describe('Flex.Container', () => {
expect(children[1]).toHaveClass('dnb-space__right--small')

expect(children[2]).toHaveClass('dnb-space__left--zero')
expect(children[2]).toHaveClass('dnb-space__right--small')
expect(children[2]).toHaveClass('dnb-space__right--zero')

rerender(
<Flex.Container spacing="large">
Expand All @@ -378,7 +378,7 @@ describe('Flex.Container', () => {
expect(children[1]).toHaveClass('dnb-space__right--large')

expect(children[2]).toHaveClass('dnb-space__left--zero')
expect(children[2]).toHaveClass('dnb-space__right--large')
expect(children[2]).toHaveClass('dnb-space__right--zero')

rerender(
<Flex.Container spacing="xx-small">
Expand All @@ -395,7 +395,7 @@ describe('Flex.Container', () => {
expect(children[1]).toHaveClass('dnb-space__right--xx-small')

expect(children[2]).toHaveClass('dnb-space__left--zero')
expect(children[2]).toHaveClass('dnb-space__right--xx-small')
expect(children[2]).toHaveClass('dnb-space__right--zero')
})

it('should not apply spacing if set to false', () => {
Expand Down Expand Up @@ -613,10 +613,10 @@ describe('Flex.Container', () => {
expect(document.querySelectorAll('.wrapper')).toHaveLength(1)
expect(
document.querySelectorAll('[class*="dnb-space__top"]')
).toHaveLength(4)
).toHaveLength(3)
expect(
document.querySelectorAll('.dnb-space__top--zero')
).toHaveLength(2)
).toHaveLength(1)
expect(
document.querySelectorAll('.dnb-space__top--small')
).toHaveLength(1)
Expand Down Expand Up @@ -672,7 +672,7 @@ describe('Flex.Container', () => {
expect(document.querySelectorAll('.wrapper')).toHaveLength(1)
expect(
document.querySelectorAll('[class*="dnb-space__"]')
).toHaveLength(3)
).toHaveLength(2)
})

it('should handle fragments like _supportsSpacingProps=children', () => {
Expand Down Expand Up @@ -719,7 +719,7 @@ describe('Flex.Container', () => {
).toHaveLength(1)
expect(
document.querySelectorAll('[class*="dnb-space__"]')
).toHaveLength(3)
).toHaveLength(1)
})
})

Expand Down
46 changes: 23 additions & 23 deletions packages/dnb-eufemia/src/components/flex/__tests__/Item.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ describe('Flex.Item', () => {
)

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])

rerender(
Expand All @@ -233,8 +233,8 @@ describe('Flex.Item', () => {
)

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--zero', 'dnb-space__right--zero'],
])
})

Expand All @@ -254,7 +254,7 @@ describe('Flex.Item', () => {
)
expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--zero'],
])

rerender(
Expand Down Expand Up @@ -329,7 +329,7 @@ describe('Flex.Item', () => {
'dnb-space__right--large',
'dnb-space__top--medium',
],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])

rerender(
Expand Down Expand Up @@ -369,7 +369,7 @@ describe('Flex.Item', () => {
expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--large'],
['dnb-space__left--x-large', 'dnb-space__right--large'],
['dnb-space__left--small', 'dnb-space__right--zero'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])

rerender(
Expand Down Expand Up @@ -402,8 +402,8 @@ describe('Flex.Item', () => {
)

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--large'],
['dnb-space__left--zero', 'dnb-space__right--large'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--small', 'dnb-space__right--zero'],
])

rerender(
Expand All @@ -414,8 +414,8 @@ describe('Flex.Item', () => {
)

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--zero', 'dnb-space__right--zero'],
])
})

Expand All @@ -431,19 +431,19 @@ describe('Flex.Item', () => {
)

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])

act(() => {
setMedia({ width: LARGE })
})

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])
})

Expand All @@ -459,19 +459,19 @@ describe('Flex.Item', () => {
)

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])

act(() => {
setMedia({ width: MEDIUM })
})

expect(getSpacingClasses()).toEqual([
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--zero', 'dnb-space__right--x-small'],
['dnb-space__left--x-small', 'dnb-space__right--zero'],
])
})
})
Expand Down

0 comments on commit 242e915

Please sign in to comment.