Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add CustomSelectControl tests
  • Loading branch information
noisysocks committed Nov 2, 2022
commit 14b433159d5803169755e62069c39f8ed65a29fc
39 changes: 39 additions & 0 deletions packages/components/src/custom-select-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,43 @@ describe( 'CustomSelectControl', () => {

expect( onKeyDown ).toHaveBeenCalledTimes( 0 );
} );

it( 'does not show selected hint by default', () => {
render(
<CustomSelectControl
label="Custom select"
options={ [
{
key: 'one',
name: 'One',
__experimentalHint: 'Hint',
},
] }
__nextUnconstrainedWidth
/>
);
expect(
screen.getByRole( 'button', { name: 'Custom select' } )
).not.toHaveTextContent( 'Hint' );
} );

it( 'shows selected hint when __experimentalShowSelectedHint is set', () => {
render(
<CustomSelectControl
label="Custom select"
options={ [
{
key: 'one',
name: 'One',
__experimentalHint: 'Hint',
},
] }
__experimentalShowSelectedHint
__nextUnconstrainedWidth
/>
);
expect(
screen.getByRole( 'button', { name: 'Custom select' } )
).toHaveTextContent( 'Hint' );
} );
} );