Skip to content

Commit

Permalink
add Tooltip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
estevanmaito committed May 17, 2019
1 parent 0d92734 commit 46fadaa
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/__tests__/Tooltip/Tooltip.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Tooltip from '../../Tooltip/Tooltip'

const icon = document.createElement('div')
icon.innerHTML = 'icon'

const icons = {
icons: icon,
length: 1
}

const props = {
top: 0,
left: 0,
iconSize: 24,
mobileIconSize: 50,
buttonMargin: 7 * 2,
backgroundColor: '#C564A4',
icons,
arrowSize: 5,
isMobile: false
}

describe('Tooltip', () => {
it('should render a desktop tooltip with one icon and one arrow as children', () => {
const tooltip = Tooltip(props)

expect(tooltip.children).toHaveLength(2)
})

it('should render a mobile tooltip without arrow', () => {
const tooltip = Tooltip({ ...props, isMobile: true })

expect(tooltip.children).toHaveLength(1)
expect(tooltip.children[0]).toEqual(icon)
})
})

0 comments on commit 46fadaa

Please sign in to comment.