Skip to content
This repository was archived by the owner on Nov 1, 2019. It is now read-only.

Commit 1220cc2

Browse files
Stefan Wullemshongaar
authored andcommitted
fix: replaced visibility for display (#162)
* replaced visibility for Display * also changed test
1 parent d291312 commit 1220cc2

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/Dropdown/Dropdown.test.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,11 @@ import 'jest-styled-components'
44

55
import { Dropdown } from '.'
66

7-
test('passing checked prop as true should show dropdown content', () => {
8-
const dropdown = mount(<Dropdown open triggerComponent={<div>test</div>}>test</Dropdown>)
9-
10-
const dropdownContent = dropdown.find({ 'data-test': 'dropdown-content' })
11-
12-
expect(dropdownContent).toHaveStyleRule('visibility', 'visible')
13-
dropdown.unmount()
14-
})
15-
16-
test('passing checked prop as false should hide dropdown content', () => {
7+
test('passing open prop as false should hide dropdown content', () => {
178
const dropdown = mount(<Dropdown open={false} triggerComponent={<div>test</div>}>test</Dropdown>)
189

1910
const dropdownContent = dropdown.find({ 'data-test': 'dropdown-content' })
2011

21-
expect(dropdownContent).toHaveStyleRule('visibility', 'hidden')
12+
expect(dropdownContent).toHaveStyleRule('display', 'none')
2213
dropdown.unmount()
2314
})

src/Dropdown/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Content = styled(Block) <ContentProps>`
3131
width: ${props.triggerWidth};
3232
`}
3333
34-
visibility: ${({ open }) => open ? 'visible' : 'hidden'};
34+
${({ open }) => !open && 'display: none;'}
3535
${({ position }) => css`${position}`}
3636
`
3737

0 commit comments

Comments
 (0)