testing-library-table-queries icon indicating copy to clipboard operation
testing-library-table-queries copied to clipboard

feature: add getRowByText('John Smith')

Open s-light opened this issue 1 year ago • 2 comments

thanks Alex for your work!! just found it and your ideas discussions in the orig. thread and your package here helped me a lot!!!

this featurerequest is for getRowByText('John Smith'): just a shorthand / alias for getByRole('row', { name: 'John Smith' }) as mentioned by kealjones-wk at https://github.com/testing-library/dom-testing-library/issues/583#issuecomment-992999990

this original verbose version is working fine for me - and i would love to have easy (for newbies) readable tests ;-)

s-light avatar Aug 15 '24 14:08 s-light

i think this is different from getRowByFirstCellText('John Smith') as i have a bunch of action columns as first columns (prepending my real data-columns)

s-light avatar Aug 15 '24 14:08 s-light

i think this is different from getRowByFirstCellText('John Smith') as i have a bunch of action columns as first columns (prepending my real data-columns)

I think semantically in this case you'd want a getRowByRowHeaderText and you'd indicate that the first actual data column is a row header? Could look at that At the moment queryAllCellsByRowAndColumnHeaders is slightly misnamed on the assumption that people don't use row headers properly - it's the first cell in a row instead.

lexanth avatar May 18 '25 17:05 lexanth