Skip to content

Commit 30632f7

Browse files
committed
Fixed issues flagged by the bot
1 parent ac1dfa9 commit 30632f7

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

frontend/__tests__/unit/components/DisplayIcon.test.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,43 @@ describe('DisplayIcon', () => {
308308
})
309309

310310
describe('Event Handling', () => {
311-
it('renders tooltip wrapper that can handle hover events', async () => {
311+
it('renders interactive tooltip that responds to user events', async () => {
312312
const user = userEvent.setup()
313313
render(<DisplayIcon item="starsCount" icons={mockIcons} />)
314314

315315
const tooltip = screen.getByTestId('tooltip')
316316
expect(tooltip).toBeInTheDocument()
317317

318+
await user.tab()
319+
expect(tooltip).toBeInTheDocument()
320+
318321
await user.hover(tooltip)
319322
expect(tooltip).toBeInTheDocument()
323+
324+
await user.unhover(tooltip)
325+
expect(tooltip).toBeInTheDocument()
326+
327+
expect(tooltip).toHaveAttribute('data-tooltip-content', 'Stars')
328+
expect(tooltip).toHaveAttribute('data-show-arrow', 'true')
329+
})
330+
331+
it('maintains tooltip accessibility during interactions', async () => {
332+
const user = userEvent.setup()
333+
render(<DisplayIcon item="forksCount" icons={mockIcons} />)
334+
335+
const tooltip = screen.getByTestId('tooltip')
336+
337+
await user.tab()
338+
expect(tooltip).toBeInTheDocument()
339+
340+
expect(tooltip).toHaveAttribute('data-placement', 'top')
341+
expect(tooltip).toHaveAttribute('data-delay', '150')
342+
343+
const iconElement = screen.getByTestId('font-awesome-icon')
344+
const textContent = screen.getByText('350')
345+
346+
expect(iconElement).toBeInTheDocument()
347+
expect(textContent).toBeInTheDocument()
320348
})
321349
})
322350
})

0 commit comments

Comments
 (0)