|
| 1 | +import React from 'react'; |
| 2 | +import LongTextTooltip from './LongTextTooltip'; |
| 3 | +import { render } from '@testing-library/react'; |
| 4 | +import { TooltipPosition } from '@patternfly/react-core'; |
| 5 | + |
| 6 | +describe('LongTextTooltip component', () => { |
| 7 | + it('should render', () => { |
| 8 | + expect(render(<LongTextTooltip />)).toMatchSnapshot(); |
| 9 | + }); |
| 10 | + |
| 11 | + it('should render content', () => { |
| 12 | + expect(render(<LongTextTooltip content="Lorem Impsum" />)).toMatchSnapshot(); |
| 13 | + }); |
| 14 | + |
| 15 | + it('should render content with maxLength', () => { |
| 16 | + expect( |
| 17 | + render(<LongTextTooltip content="Lorem Impsum" maxLength={50} />)).toMatchSnapshot(); |
| 18 | + }); |
| 19 | + |
| 20 | + it('should render content with maxLength shorter than content', () => { |
| 21 | + expect(render(<LongTextTooltip content="Lorem Impsum" maxLength={1} />)).toMatchSnapshot(); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should render tooltip in a different spot', () => { |
| 25 | + expect(render(<LongTextTooltip content="Lorem Impsum" tooltipPosition={TooltipPosition.bottom}/>)).toMatchSnapshot(); |
| 26 | + }); |
| 27 | + |
| 28 | + it('should render tooltip in a different spot', () => { |
| 29 | + expect(render(<LongTextTooltip content="Lorem Impsum" tooltipPosition={TooltipPosition.left} />)).toMatchSnapshot(); |
| 30 | + }); |
| 31 | + |
| 32 | + it('should render tooltip in a different spot', () => { |
| 33 | + expect(render(<LongTextTooltip content="Lorem Impsum" tooltipPosition={TooltipPosition.right} />)).toMatchSnapshot(); |
| 34 | + }); |
| 35 | + |
| 36 | + it('should render content tooltip in a different spot with different width', () => { |
| 37 | + expect(render(<LongTextTooltip content="Lorem Impsum" tooltipPosition={TooltipPosition.left} tooltipMaxWidth="10vw" />)).toMatchSnapshot(); |
| 38 | + }); |
| 39 | +}); |
0 commit comments