Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
const NO_RESULTS = {
bodyText: 'Adjust your search query and try again. Check your spelling or try a more general term.',
titleText: 'No results found',
icon: SearchIcon as ComponentType<any>

Check warning on line 28 in packages/module/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx

View workflow job for this annotation

GitHub Actions / call-build-lint-test-workflow / lint

Unexpected any. Specify a different type
};

const EMPTY_STATE = {
bodyText: 'Access timely assistance by starting a conversation with an AI model.',
titleText: 'Start a new chat',
icon: OutlinedCommentsIcon as ComponentType<any>

Check warning on line 34 in packages/module/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx

View workflow job for this annotation

GitHub Actions / call-build-lint-test-workflow / lint

Unexpected any. Specify a different type
};

const ERROR_WITHOUT_BUTTON = {
Expand Down Expand Up @@ -561,4 +561,20 @@
);
expect(screen.getByRole('listitem')).toHaveClass('test');
});

it('should be able to spread search input props when searchInputProps is passed', () => {
render(
<ChatbotConversationHistoryNav
onDrawerToggle={onDrawerToggle}
isDrawerOpen={true}
displayMode={ChatbotDisplayMode.fullscreen}
setIsDrawerOpen={jest.fn()}
conversations={initialConversations}
handleTextInputChange={jest.fn()}
searchInputProps={{ value: 'I am a sample search' }}
/>
);

expect(screen.getByRole('dialog', { name: /Chat history I am a sample search/i })).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
Icon,
MenuProps, // Remove in next breaking change
TitleProps,
ListProps
ListProps,
SearchInputProps
} from '@patternfly/react-core';

import { OutlinedClockIcon, OutlinedCommentAltIcon, PenToSquareIcon } from '@patternfly/react-icons';
Expand Down Expand Up @@ -94,6 +95,8 @@ export interface ChatbotConversationHistoryNavProps extends DrawerProps {
searchInputPlaceholder?: string;
/** Aria label for search input */
searchInputAriaLabel?: string;
/** Additional props passed to search input */
searchInputProps?: SearchInputProps;
/** A callback for when the input value changes. Omit to hide input field */
handleTextInputChange?: (value: string) => void;
/** Display mode of chatbot */
Expand Down Expand Up @@ -149,6 +152,7 @@ export const ChatbotConversationHistoryNav: FunctionComponent<ChatbotConversatio
newChatButtonProps,
searchInputPlaceholder = 'Search previous conversations...',
searchInputAriaLabel = 'Filter menu items',
searchInputProps,
handleTextInputChange,
displayMode,
reverseButtonOrder = false,
Expand Down Expand Up @@ -292,6 +296,7 @@ export const ChatbotConversationHistoryNav: FunctionComponent<ChatbotConversatio
aria-label={searchInputAriaLabel}
onChange={(_event, value) => handleTextInputChange(value)}
placeholder={searchInputPlaceholder}
{...searchInputProps}
/>
</div>
)}
Expand Down
Loading