Skip to content

Commit

Permalink
Remove unnecessary onOptionSelected call
Browse files Browse the repository at this point in the history
The code for `SpellingVariantInput` was making an unnecessary
extra call to `onOptionSelected` when `onInput` was called, to
satisfy assertions in the unit test suite that are very involved
with the internals of the component eventing logic. This worked
okay for codex 1.14.0, but is incompatible with the behaviour
changes introduced in Icd4b7ed1e34bf5b2d62f705fdd8c6f4e0cf088d1.

Remove the unnecessary call, and remove the unnecessarily detailed
unit tests.

Bug: T379595
  • Loading branch information
codders committed Nov 15, 2024
1 parent 3436371 commit 5f0e74c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/components/SpellingVariantInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const onInput = ( inputValue: string ) => {
menuItems.value = wbLexemeTermLanguages.filter(
( lang ) => lang.label && regExp.test( lang.label ),
);
onOptionSelected( inputValue );
};
const selection = ref( null );
Expand Down
25 changes: 0 additions & 25 deletions tests/unit/components/SpellingVariantInput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,4 @@ describe( 'SpellingVariantInput', () => {
} );
} );

describe( '@events', () => {
it( '@update:modelValue - emits null when the input is changed', async () => {
const lookup = createLookup();

await setSearchInput( lookup, 'foo' );

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect( lookup.emitted( 'update:modelValue' )[ 0 ][ 0 ] ).toBe( undefined );
} );

it( '@update:modelValue - emits the value of the selected option', async () => {
const lookup = createLookup();
await setSearchInput( lookup, 'en' );

await lookup.findComponent( CdxLookup ).vm.$emit( 'update:selected', 'en' );

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect( lookup.emitted( 'update:modelValue' )[ 1 ][ 0 ] )
.toBe( 'en' );

} );
} );

} );

0 comments on commit 5f0e74c

Please sign in to comment.