-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d92734
commit 46fadaa
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |