/* eslint-disable react/button-has-type */ import * as React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; import Tooltip, { TooltipPosition, TooltipTheme } from '../Tooltip'; import TetherPosition from '../../../common/tether-positions'; const sandbox = sinon.sandbox.create(); describe('components/tooltip/Tooltip', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const getWrapper = (props: Record) => shallow(
Hello
, ); afterEach(() => { sandbox.verifyAndRestore(); }); describe('render()', () => { test('should render with close button if isShown and showCloseButton are true', () => { expect( getWrapper({ isShown: true, showCloseButton: true, }), ).toMatchSnapshot(); }); test('should not render the close button if wasClosedByUser state is true', () => { const wrapper = getWrapper({ isShown: true, showCloseButton: true, }); wrapper.setState({ wasClosedByUser: true }); expect(wrapper).toMatchSnapshot(); }); test('should not render with close button if showCloseButton is false', () => { expect( getWrapper({ isShown: true, showCloseButton: false, }), ).toMatchSnapshot(); }); test('should not render with close button if isShown is false', () => { const wrapper = getWrapper({ isShown: false, showCloseButton: true, }); wrapper.setState({ isShown: true }); expect(wrapper).toMatchSnapshot(); }); test('should render correctly with callout theme', () => { expect( getWrapper({ isShown: true, theme: 'callout', }), ).toMatchSnapshot(); }); test('should render default component', () => { const wrapper = shallow(