11import '@testing-library/jest-dom' ;
2- import { DropdownGroup , DropdownItem , DropdownList } from '@patternfly/react-core' ;
2+ import {
3+ DropdownGroup ,
4+ DropdownItem ,
5+ DropdownList ,
6+ MenuSearchInputProps ,
7+ MenuSearchProps
8+ } from '@patternfly/react-core' ;
39import { BellIcon , CalendarAltIcon , ClipboardIcon , CodeIcon } from '@patternfly/react-icons' ;
410import { render , screen } from '@testing-library/react' ;
511import userEvent from '@testing-library/user-event' ;
@@ -218,7 +224,7 @@ describe('Message bar', () => {
218224 await userEvent . click ( attachButton ) ;
219225 expect ( attachToggleClickSpy ) . toHaveBeenCalledTimes ( 1 ) ;
220226 } ) ;
221- it ( 'can pass props to search input in AttachMenu' , ( ) => {
227+ it ( 'can pass searchInputProps to search input in AttachMenu' , ( ) => {
222228 render (
223229 < MessageBar
224230 onSendMessage = { jest . fn }
@@ -235,6 +241,40 @@ describe('Message bar', () => {
235241 ) ;
236242 expect ( screen . getByRole ( 'textbox' , { name : / F i l t e r m e n u i t e m s / i } ) ) . toBeDisabled ( ) ;
237243 } ) ;
244+ it ( 'can pass menuSearchProps to search input in AttachMenu' , ( ) => {
245+ render (
246+ < MessageBar
247+ onSendMessage = { jest . fn }
248+ value = "test"
249+ attachMenuProps = { {
250+ isAttachMenuOpen : true ,
251+ setIsAttachMenuOpen : jest . fn ( ) ,
252+ onAttachMenuToggleClick : jest . fn ( ) ,
253+ onAttachMenuInputChange : jest . fn ( ) ,
254+ attachMenuItems : ATTACH_MENU_ITEMS ,
255+ menuSearchProps : { 'data-testid' : 'menu-search' } as MenuSearchProps
256+ } }
257+ />
258+ ) ;
259+ expect ( screen . getByTestId ( 'menu-search' ) ) . toBeTruthy ( ) ;
260+ } ) ;
261+ it ( 'can pass menuSearchInputProps to search input in AttachMenu' , ( ) => {
262+ render (
263+ < MessageBar
264+ onSendMessage = { jest . fn }
265+ value = "test"
266+ attachMenuProps = { {
267+ isAttachMenuOpen : true ,
268+ setIsAttachMenuOpen : jest . fn ( ) ,
269+ onAttachMenuToggleClick : jest . fn ( ) ,
270+ onAttachMenuInputChange : jest . fn ( ) ,
271+ attachMenuItems : ATTACH_MENU_ITEMS ,
272+ menuSearchInputProps : { 'data-testid' : 'menu-search-input' } as MenuSearchInputProps
273+ } }
274+ />
275+ ) ;
276+ expect ( screen . getByTestId ( 'menu-search-input' ) ) . toBeTruthy ( ) ;
277+ } ) ;
238278 it ( 'can hide attach button' , ( ) => {
239279 render ( < MessageBar onSendMessage = { jest . fn } hasAttachButton = { false } /> ) ;
240280 expect ( screen . queryByRole ( 'button' , { name : 'Attach' } ) ) . toBeFalsy ( ) ;
0 commit comments