Skip to content

Commit

Permalink
feat(boxai-sidebar): PR fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DanilaRubleuski committed Dec 23, 2024
1 parent 837ccf2 commit 297d949
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/elements/content-sidebar/BoxAISidebarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as React from 'react';
import flow from 'lodash/flow';
import { useIntl } from 'react-intl';
import { AgentsProvider, BoxAiAgentSelectorWithApi } from '@box/box-ai-agent-selector';
import { IconButton, Text } from '@box/blueprint-web';
import {IconButton, Text, Tooltip} from '@box/blueprint-web';
import { Trash } from '@box/blueprint-web-assets/icons/Line';
// @ts-expect-error - TS2305 - Module '"@box/box-ai-content-answers"' has no exported member 'ApiWrapperProps'.
import { BoxAiContentAnswers, withApiWrapper, type ApiWrapperProps } from '@box/box-ai-content-answers'
Expand All @@ -23,7 +23,6 @@ import messages from '../common/messages';
import sidebarMessages from './messages';

import './BoxAISidebar.scss';
import Tooltip, {TooltipPosition} from "../../components/tooltip/Tooltip";


const MARK_NAME_JS_READY: string = `${ORIGIN_BOXAI_SIDEBAR}_${EVENT_JS_READY}`;
Expand Down Expand Up @@ -99,7 +98,7 @@ function BoxAISidebarContent(props: ApiWrapperProps) {
<>
{ renderBoxAISidebarTitle() }
{ isResetChatEnabled &&
<Tooltip position={TooltipPosition.MIDDLE_LEFT} text={formatMessage(sidebarMessages.boxAISidebarClearConversationTooltip)} isTabbable={false}>
<Tooltip content={formatMessage(sidebarMessages.boxAISidebarClearConversationTooltip)}>
<IconButton
aria-label={formatMessage(sidebarMessages.boxAISidebarClear)}
icon={Trash}
Expand Down
11 changes: 11 additions & 0 deletions src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { userEvent } from '@testing-library/user-event';
import { render, screen } from '../../../test-utils/testing-library';
import BoxAISidebar, { BoxAISidebarProps } from '../BoxAISidebar';
import messages from "../../common/content-answers/messages";

jest.mock('@box/box-ai-agent-selector', () => ({
...jest.requireActual('@box/box-ai-agent-selector'),
Expand Down Expand Up @@ -169,4 +170,14 @@ describe('elements/content-sidebar/BoxAISidebar', () => {
expect(screen.getByText('completed question')).toBeInTheDocument();
expect(screen.queryByText('not completed question')).not.toBeInTheDocument();
});

test('should display clear conversation tooltip', async () => {
await renderComponent();

const button = screen.getByRole('button', { name: 'Clear' });
await userEvent.hover(button);
const tooltip = await screen.findByRole('tooltip', { name: 'Clear conversation' });

expect(tooltip).toBeInTheDocument();
});
});

0 comments on commit 297d949

Please sign in to comment.