-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAS-125370 / 24.04 / Integration tests for autocomplete (#9354)
- Loading branch information
Showing
15 changed files
with
464 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 0 additions & 140 deletions
140
src/app/modules/search-input/components/advanced-search/advanced-search.component.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/app/modules/search-input/components/advanced-search/codemirror-autocomplete.harness.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ComponentHarness, parallel } from '@angular/cdk/testing'; | ||
|
||
export class CodemirrorAutocompleteHarness extends ComponentHarness { | ||
static hostSelector = '.cm-tooltip-autocomplete'; | ||
|
||
private getOptionElements = this.locatorForAll('li'); | ||
|
||
async getOptions(): Promise<string[]> { | ||
const items = await this.getOptionElements(); | ||
return parallel(() => items.map((item) => item.text())); | ||
} | ||
|
||
async select(text: string): Promise<void> { | ||
const items = await this.getOptionElements(); | ||
let selectedItem = null; | ||
|
||
for (const item of items) { | ||
if ((await item.text()) === text) { | ||
selectedItem = item; | ||
break; | ||
} | ||
} | ||
|
||
if (!selectedItem) { | ||
throw new Error(`Cannot find item with text "${text}"`); | ||
} | ||
|
||
return selectedItem.click(); | ||
} | ||
} |
Oops, something went wrong.