Adding Tests with React Testing Library Best Approach

Tags: #<Tag:0x00007f455062e598> #<Tag:0x00007f455062e458>

Hi,

We have multiple instances where we want to test certain cells / columns with React Testing Library.

So for instance we might have a component something like

const Component => <HotTable columns={[{ data: 'test', title: 'Test' ]} data={[{ test: 'a' }, { test: 'b' }, { test: 'c' }]}   />

And then our test might be something like

const screen = render(<Component />)

I was thinking that this would render the whole of the table but it appears we can only access the first cell on the first column. Making it difficult to test other values.

Do you have any advise on how we either solve the issue above or how we could test handsontable

Thanks, James

Hi @james.dale

We have no experience in testing Handsontable with React Testing Library. However, is this exactly how your code looks like?

const Component => <HotTable columns={[{ data: 'test', title: 'Test' ]} data={[{ test: 'a' }, { test: 'b' }, { test: 'c' }]}   />

I mean, what is exactly under the test key, because in current form it will indeed render only one cell.