* Returns a tab matching the specified index or text content.
(opts: {indexOrText: number | string})
| 61 | * Returns a tab matching the specified index or text content. |
| 62 | */ |
| 63 | findTab(opts: {indexOrText: number | string}): HTMLElement { |
| 64 | let {indexOrText} = opts; |
| 65 | |
| 66 | let tab; |
| 67 | let tabs = this.getTabs(); |
| 68 | if (typeof indexOrText === 'number') { |
| 69 | tab = tabs[indexOrText]; |
| 70 | } else if (typeof indexOrText === 'string') { |
| 71 | tab = within(this._tablist).getByText(indexOrText).closest('[role=tab]')! as HTMLElement; |
| 72 | } |
| 73 | |
| 74 | return tab; |
| 75 | } |
| 76 | |
| 77 | private async keyboardNavigateToTab(opts: {tab: HTMLElement; orientation?: Orientation}) { |
| 78 | let {tab, orientation = 'vertical'} = opts; |
no test coverage detected