Skip to content

Commit

Permalink
add Tooltip styles tests
Browse files Browse the repository at this point in the history
  • Loading branch information
estevanmaito committed May 17, 2019
1 parent 8f46369 commit d9bda99
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/__tests__/Tooltip/style.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
defaultStyle,
mobileStyle,
desktopStyle
} from '../../Tooltip/style'

describe('Tooltip styles', () => {
describe('defaultStyle', () => {
it('should return the default styles', () => {
const backgroundColor = '#C562A4'

const expected = "line-height:0;" +
"transition:all .2s ease-in-out;" +
"background:" + backgroundColor + ";"

expect(defaultStyle(backgroundColor)).toEqual(expected)
})
})

describe('mobileStyle', () => {
it('should return mobile styles', () => {
const buttonSize = 50

const expected = "position:fixed;" +
"bottom:calc(50% - 64px);" +
"left:0;" +
"width:" + buttonSize + "px;" +
"border-top-right-radius:5px;" +
"border-bottom-right-radius:5px;"

expect(mobileStyle(buttonSize)).toEqual(expected)
})
})

describe('desktopStyle', () => {
it('should return desktop styles', () => {
const [top, left] = [10, 20]

const expected = "position:absolute;" +
"border-radius:3px;" +
"top:" + top + "px;" +
"left:" + left + "px;"

expect(desktopStyle(top, left)).toEqual(expected)
})
})
})

0 comments on commit d9bda99

Please sign in to comment.