From 077663788d3e0c4bc75ad7a0a9a1cbc24cf4e571 Mon Sep 17 00:00:00 2001 From: Naresh Pingale Date: Tue, 23 Jul 2024 12:51:37 +0530 Subject: [PATCH] chore: adding tests for disableTooltip prop --- .../__snapshots__/tooltip-props.spec.js.snap | 22 +++++++++++++ src/test/tooltip-props.spec.js | 31 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/test/__snapshots__/tooltip-props.spec.js.snap b/src/test/__snapshots__/tooltip-props.spec.js.snap index face6e5c..9dc8d750 100644 --- a/src/test/__snapshots__/tooltip-props.spec.js.snap +++ b/src/test/__snapshots__/tooltip-props.spec.js.snap @@ -100,6 +100,28 @@ exports[`tooltip props tooltip with delay show 1`] = ` `; +exports[`tooltip props tooltip with disableTooltip return false 1`] = ` +
+ + Lorem Ipsum + + +`; + exports[`tooltip props tooltip with float 1`] = `
{ expect(tooltip).toBeInTheDocument() expect(container).toMatchSnapshot() }) + + test('tooltip with disableTooltip return true', async () => { + render( + true} + />, + ) + const anchorElement = screen.getByText('Lorem Ipsum') + await userEvent.hover(anchorElement) + + expect(screen.queryByRole('tooltip')).not.toBeInTheDocument() + }) + + test('tooltip with disableTooltip return false', async () => { + const { container } = render( + false} + />, + ) + const anchorElement = screen.getByText('Lorem Ipsum') + await userEvent.hover(anchorElement) + + const tooltip = await screen.findByRole('tooltip') + + expect(tooltip).toBeInTheDocument() + expect(container).toMatchSnapshot() + }) })