(opts?: {
orientation?: 'horizontal' | 'vertical';
disabled?: boolean;
readonly?: boolean;
value?: number[];
softDisabled?: boolean;
focusMode?: 'roving' | 'activedescendant';
multi?: boolean;
wrap?: boolean;
selectionMode?: 'follow' | 'explicit';
typeaheadDelay?: number;
disabledOptions?: number[];
options?: TestOption[];
textDirection?: Direction;
tabIndex?: number;
})
| 54 | const type = async (char: string) => await keydown(char); |
| 55 | |
| 56 | async function setupListbox(opts?: { |
| 57 | orientation?: 'horizontal' | 'vertical'; |
| 58 | disabled?: boolean; |
| 59 | readonly?: boolean; |
| 60 | value?: number[]; |
| 61 | softDisabled?: boolean; |
| 62 | focusMode?: 'roving' | 'activedescendant'; |
| 63 | multi?: boolean; |
| 64 | wrap?: boolean; |
| 65 | selectionMode?: 'follow' | 'explicit'; |
| 66 | typeaheadDelay?: number; |
| 67 | disabledOptions?: number[]; |
| 68 | options?: TestOption[]; |
| 69 | textDirection?: Direction; |
| 70 | tabIndex?: number; |
| 71 | }) { |
| 72 | TestBed.configureTestingModule({ |
| 73 | providers: [provideFakeDirectionality(opts?.textDirection ?? 'ltr')], |
| 74 | }); |
| 75 | |
| 76 | fixture = TestBed.createComponent(ListboxExample); |
| 77 | const testComponent = fixture.componentInstance as ListboxExample; |
| 78 | |
| 79 | if (opts?.orientation !== undefined) testComponent.orientation = opts.orientation; |
| 80 | if (opts?.disabled !== undefined) testComponent.disabled = opts.disabled; |
| 81 | if (opts?.readonly !== undefined) testComponent.readonly = opts.readonly; |
| 82 | if (opts?.value !== undefined) testComponent.value = opts.value; |
| 83 | if (opts?.softDisabled !== undefined) testComponent.softDisabled = opts.softDisabled; |
| 84 | if (opts?.focusMode !== undefined) testComponent.focusMode = opts.focusMode; |
| 85 | if (opts?.multi !== undefined) testComponent.multi = opts.multi; |
| 86 | if (opts?.wrap !== undefined) testComponent.wrap = opts.wrap; |
| 87 | if (opts?.selectionMode !== undefined) testComponent.selectionMode = opts.selectionMode; |
| 88 | if (opts?.typeaheadDelay !== undefined) testComponent.typeaheadDelay = opts.typeaheadDelay; |
| 89 | if (opts?.options !== undefined) testComponent.options.set(opts.options); |
| 90 | if (opts?.tabIndex !== undefined) testComponent.tabIndex = opts.tabIndex; |
| 91 | |
| 92 | if (opts?.disabledOptions !== undefined) { |
| 93 | const currentOptions = testComponent.options(); |
| 94 | opts.disabledOptions.forEach(index => { |
| 95 | if (currentOptions[index]) currentOptions[index].disabled = true; |
| 96 | }); |
| 97 | testComponent.options.set([...currentOptions]); |
| 98 | } |
| 99 | |
| 100 | await fixture.whenStable(); |
| 101 | defineTestVariables(fixture); |
| 102 | } |
| 103 | |
| 104 | async function setupDefaultListbox() { |
| 105 | TestBed.configureTestingModule({ |
no test coverage detected
searching dependent graphs…