Skip to content

Commit

Permalink
test: add test for tooltip (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
KiruthikaJeyashankar authored Oct 30, 2023
1 parent 914e736 commit 984d127
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/packages/ToolTip/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable react/no-children-prop */
import React from 'react'
import { fireEvent, render, screen } from '../../utils/testUtils'

import ToolTip from '.'

describe('<ToolTip/>', () => {
const tooltipArgs = {
children: 'Hover me',
content: 'Tooltip text here'
}
it('should render the tooltip text', () => {
render(<ToolTip {...tooltipArgs} />)

expect(screen.getByText('Hover me')).toBeInTheDocument()
})

it('should render the tooltip content when hovered over the text', async () => {
render(<ToolTip {...tooltipArgs} />)
const tooltipText = screen.getByText('Hover me')

fireEvent.mouseOver(tooltipText)

await screen.findByText('Tooltip text here')
})
})

0 comments on commit 984d127

Please sign in to comment.