@@ -407,16 +407,45 @@ describe('Combobox', () => {
407407 expect ( input ) . toHaveFocus ( ) ;
408408 } ) ;
409409
410- it ( 'handles `renderValue` as expected' , ( ) => {
411- const { getByTestId } = render (
412- < TestCombobox renderValue = { ( { selection } ) => `test-${ ( selection as ISelectedOption ) . value } ` } >
413- < Option isSelected value = "value" />
414- </ TestCombobox >
415- ) ;
416- const input = getByTestId ( 'input' ) ;
410+ describe ( '`renderValue`' , ( ) => {
411+ it ( 'handles custom value as expected' , async ( ) => {
412+ const { getByTestId } = render (
413+ < TestCombobox
414+ renderValue = { ( { selection } ) => `test-${ ( selection as ISelectedOption ) . value } ` }
415+ >
416+ < Option isSelected value = "value" />
417+ </ TestCombobox >
418+ ) ;
419+ const combobox = getByTestId ( 'combobox' ) ;
420+ const trigger = combobox . firstChild as HTMLElement ;
421+ const input = getByTestId ( 'input' ) ;
422+
423+ await user . click ( trigger ) ;
417424
418- expect ( input ) . toHaveValue ( 'value' ) ;
419- expect ( input . previousSibling ) . toHaveTextContent ( 'test-value' ) ;
425+ expect ( input ) . not . toHaveAttribute ( 'hidden' ) ;
426+ expect ( input ) . toHaveValue ( 'value' ) ;
427+ expect ( input . previousSibling ) . toHaveTextContent ( 'test-value' ) ;
428+ } ) ;
429+
430+ it ( 'handles disabled with custom value as expected' , async ( ) => {
431+ const { getByTestId } = render (
432+ < TestCombobox
433+ isDisabled
434+ renderValue = { ( { selection } ) => `test-${ ( selection as ISelectedOption ) . value } ` }
435+ >
436+ < Option isSelected value = "value" />
437+ </ TestCombobox >
438+ ) ;
439+ const combobox = getByTestId ( 'combobox' ) ;
440+ const trigger = combobox . firstChild as HTMLElement ;
441+ const input = getByTestId ( 'input' ) ;
442+
443+ await user . click ( trigger ) ;
444+
445+ expect ( input ) . toHaveAttribute ( 'hidden' ) ;
446+ expect ( input ) . toHaveValue ( 'value' ) ;
447+ expect ( input . previousSibling ) . toHaveTextContent ( 'test-value' ) ;
448+ } ) ;
420449 } ) ;
421450
422451 describe ( 'validation' , ( ) => {
0 commit comments