-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #721 from dennisja/fix-tooltip-with-bounds
Fix tooltip with bounds
- Loading branch information
Showing
3 changed files
with
34 additions
and
13 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
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
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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
import { TooltipWithBounds } from '../src'; | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { TooltipWithBounds, defaultStyles } from '../src'; | ||
|
||
describe('<TooltipWithBounds />', () => { | ||
test('it should be defined', () => { | ||
expect(TooltipWithBounds).toBeDefined(); | ||
}); | ||
|
||
it('should render the Tooltip with default styles by default', () => { | ||
const wrapper = shallow(<TooltipWithBounds>Hello</TooltipWithBounds>, { | ||
disableLifecycleMethods: true, | ||
}).dive(); | ||
const styles = wrapper.find('Tooltip').props().style as any; | ||
Object.entries(defaultStyles).forEach(([key, value]) => { | ||
expect(styles[key]).toBe(value); | ||
}); | ||
}); | ||
|
||
it('should render the tooltip without default styles if unstyled is set to true', () => { | ||
const wrapper = shallow(<TooltipWithBounds unstyled>Hello</TooltipWithBounds>, { | ||
disableLifecycleMethods: true, | ||
}).dive(); | ||
const styles = wrapper.find('Tooltip').props().style as any; | ||
Object.keys(defaultStyles).forEach(key => { | ||
expect(styles[key]).toBeUndefined(); | ||
}); | ||
}); | ||
}); |