diff --git a/src/Tooltip.tsx b/src/Tooltip.tsx index 69e1d36..4948c32 100644 --- a/src/Tooltip.tsx +++ b/src/Tooltip.tsx @@ -37,6 +37,7 @@ export interface TooltipProps extends Pick { diff --git a/tests/index.test.js b/tests/index.test.js index 6a7b161..30e2ebc 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -10,6 +10,9 @@ const verifyContent = (wrapper, content) => { }; describe('rc-tooltip', () => { + window.requestAnimationFrame = window.setTimeout; + window.cancelAnimationFrame = window.clearTimeout; + describe('shows and hides itself on click', () => { it('using an element overlay', () => { const wrapper = mount( @@ -145,4 +148,26 @@ describe('rc-tooltip', () => { expect(wrapper.find('Trigger').props().popupMotion).toEqual({ motionName: 'bamboo-is-light' }); }); + + it('zIndex', () => { + jest.useFakeTimers(); + + const wrapper = mount( + +
Light
+
, + ); + wrapper.find('.target').simulate('click'); + + jest.runAllTimers(); + wrapper.update(); + + expect(wrapper.find('div.rc-tooltip').prop('style')).toEqual( + expect.objectContaining({ + zIndex: 903, + }), + ); + + jest.useRealTimers(); + }); });