* Returns a row matching the specified index or text content.
(opts: {indexOrText: number | string})
| 478 | * Returns a row matching the specified index or text content. |
| 479 | */ |
| 480 | findRow(opts: {indexOrText: number | string}): HTMLElement { |
| 481 | let {indexOrText} = opts; |
| 482 | |
| 483 | let row; |
| 484 | let rows = this.getRows(); |
| 485 | let bodyRowGroup = this.getRowGroups()[1]; |
| 486 | if (typeof indexOrText === 'number') { |
| 487 | row = rows[indexOrText]; |
| 488 | } else if (typeof indexOrText === 'string') { |
| 489 | row = within(bodyRowGroup).getByText(indexOrText); |
| 490 | while (row && row.getAttribute('role') !== 'row') { |
| 491 | row = row.parentElement; |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | return row; |
| 496 | } |
| 497 | |
| 498 | /** |
| 499 | * Returns a cell matching the specified text content. |
no test coverage detected