-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2320 from MahtabBukhari/resolved_cutting_off_the_…
…tooltip_at_AI_answer Ensure hover modal is NOT cut off
- Loading branch information
Showing
5 changed files
with
50 additions
and
38 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/components/App/SideBar/AiSummary/AiAnswer/__tests__/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react' | ||
import { render, screen, fireEvent, waitFor } from '@testing-library/react' | ||
import { AiAnswer } from '../index' | ||
import { ExtractedEntity } from '~/types/index' | ||
|
||
describe('AiAnswer Component', () => { | ||
const mockHandleLoaded = jest.fn() | ||
|
||
const renderComponent = (answer, entities) => { | ||
render(<AiAnswer answer={answer} entities={entities} handleLoaded={mockHandleLoaded} hasBeenRendered={false} />) | ||
} | ||
|
||
it('should display shows tooltip on hover over entity', async () => { | ||
const entities: ExtractedEntity[] = [ | ||
{ | ||
entity: 'React', | ||
description: 'A JavaScript library for building user interfaces.', | ||
}, | ||
] | ||
|
||
renderComponent('Learn about React and its features.', entities) | ||
|
||
await waitFor(() => expect(screen.getByText(/React/)).toBeInTheDocument()) | ||
|
||
const reactEntity = screen.getByText( | ||
(content, element) => content.startsWith('React') && element.tagName === 'SPAN', | ||
) | ||
|
||
fireEvent.mouseOver(reactEntity) | ||
|
||
const tooltip = await screen.findByText('A JavaScript library for building user interfaces.') | ||
|
||
expect(tooltip).toBeVisible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters