MCPcopy Index your code
hub / github.com/adobe/react-spectrum / findRow

Method findRow

packages/@react-aria/test-utils/src/table.ts:480–496  ·  view source on GitHub ↗

* Returns a row matching the specified index or text content.

(opts: {indexOrText: number | string})

Source from the content-addressed store, hash-verified

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.

Callers 3

toggleRowSelectionMethod · 0.95
toggleRowExpansionMethod · 0.95
triggerRowActionMethod · 0.95

Calls 2

getRowsMethod · 0.95
getRowGroupsMethod · 0.95

Tested by

no test coverage detected