Skip to content

Commit

Permalink
use shallow in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisja committed May 29, 2020
1 parent 0e40447 commit 619a003
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/vx-tooltip/test/TooltipWithBounds.test.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import React from 'react';
import { mount } from 'enzyme';
import { TooltipWithBounds, defaultStyles, Tooltip } from '../src';
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 = mount(<TooltipWithBounds>Hello</TooltipWithBounds>);
const styles = wrapper.find(Tooltip).props().style as any;
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 = mount(<TooltipWithBounds unstyled>Hello</TooltipWithBounds>);
const styles = wrapper.find(Tooltip).props().style as any;
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();
});
Expand Down

0 comments on commit 619a003

Please sign in to comment.