From 13b9f941a7e09b5b24a3de7dbee25daa58543a10 Mon Sep 17 00:00:00 2001 From: Jonathan Meyer <26874831+atmgrifter00@users.noreply.github.com> Date: Tue, 5 Mar 2024 14:06:07 -0600 Subject: [PATCH] Handle PR feedback. --- packages/nimble-components/src/select/index.ts | 13 +++++++------ .../src/select/testing/select.pageobject.ts | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/nimble-components/src/select/index.ts b/packages/nimble-components/src/select/index.ts index f736e4874d..5370b1f06f 100644 --- a/packages/nimble-components/src/select/index.ts +++ b/packages/nimble-components/src/select/index.ts @@ -50,7 +50,7 @@ declare global { // eslint-disable-next-line @typescript-eslint/no-invalid-void-type type BooleanOrVoid = boolean | void; -const isListOption = (el: Element): el is ListOption => { +const isNimbleListOption = (el: Element): el is ListOption => { return el instanceof ListOption; }; @@ -353,7 +353,7 @@ export class Select extends FormAssociatedSelect implements ErrorPattern { break; } case 'selected': { - if (isListOption(sourceElement)) { + if (isNimbleListOption(sourceElement)) { this.selectedIndex = this.options.indexOf(sourceElement); } this.setSelectedOptions(); @@ -361,7 +361,7 @@ export class Select extends FormAssociatedSelect implements ErrorPattern { break; } case 'hidden': { - if (isListOption(sourceElement)) { + if (isNimbleListOption(sourceElement)) { sourceElement.visuallyHidden = sourceElement.hidden; } this.updateDisplayValue(); @@ -773,7 +773,7 @@ export class Select extends FormAssociatedSelect implements ErrorPattern { */ protected override setDefaultSelectedOption(): void { const options: ListboxOption[] = this.options - ?? Array.from(this.children).filter(o => isListOption(o)); + ?? Array.from(this.children).filter(o => isNimbleListOption(o)); const optionIsSelected = (option: ListboxOption): boolean => { return option.hasAttribute('selected') || option.selected; @@ -845,10 +845,11 @@ export class Select extends FormAssociatedSelect implements ErrorPattern { if (filter) { this.filteredOptions = this.options.filter(option => { + const normalizedFilter = diacriticInsensitiveStringNormalizer(filter); return ( !option.hidden && diacriticInsensitiveStringNormalizer(option.text).includes( - diacriticInsensitiveStringNormalizer(filter) + normalizedFilter ) ); }); @@ -859,7 +860,7 @@ export class Select extends FormAssociatedSelect implements ErrorPattern { } this.options.forEach(o => { - if (isListOption(o)) { + if (isNimbleListOption(o)) { if (!this.filteredOptions.includes(o)) { o.visuallyHidden = true; } else { diff --git a/packages/nimble-components/src/select/testing/select.pageobject.ts b/packages/nimble-components/src/select/testing/select.pageobject.ts index 2be25473fb..c8a5d236f0 100644 --- a/packages/nimble-components/src/select/testing/select.pageobject.ts +++ b/packages/nimble-components/src/select/testing/select.pageobject.ts @@ -96,7 +96,9 @@ export class SelectPageObject { * Click the option with the text provided by the 'displayText' parameter. * @param value The text of the option to be selected */ - public async clickOptionWithDisplayText(displayText: string): Promise { + public async clickOptionWithDisplayText( + displayText: string + ): Promise { if (!this.selectElement.open) { await this.clickSelect(); }