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 unit test
  • Loading branch information
stokesman authored and ciampo committed Mar 21, 2022
commit 4bfdd1c68f76d4b1c62e6d8196e49d2a80f7f073
19 changes: 19 additions & 0 deletions packages/components/src/unit-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,25 @@ describe( 'UnitControl', () => {
await waitFor( () => expect( selectA ).toHaveValue( 'vw' ) );
expect( selectB ).toHaveValue( 'vw' );
} );

it( 'should maintain the chosen non-default unit when value is cleared', async () => {
const units = [
{ value: 'pt', label: 'pt' },
{ value: 'vmax', label: 'vmax' },
];

const { user } = render(
<UnitControl units={ units } value="5" />
);

const select = getSelect();
await user.selectOptions( select, [ 'vmax' ] );

const input = getInput();
await user.clear( input );

expect( select ).toHaveValue( 'vmax' );
} );
} );

describe( 'Unit Parser', () => {
Expand Down