diff --git a/src/Body/BodyRow.tsx b/src/Body/BodyRow.tsx index 946685c07..15fa35fbb 100644 --- a/src/Body/BodyRow.tsx +++ b/src/Body/BodyRow.tsx @@ -32,6 +32,7 @@ export interface BodyRowProps { onRow: GetComponentProps; rowExpandable: (record: RecordType) => boolean; indent?: number; + rowKey: React.Key; getRowKey: GetRowKey; childrenColumnName: string; } @@ -43,6 +44,7 @@ function BodyRow(props: BodyRowP stickyOffsets, record, index, + rowKey, getRowKey, rowExpandable, onRow, @@ -118,6 +120,7 @@ function BodyRow(props: BodyRowP const baseRowNode = ( ({ return [ { ); expect(wrapper.find('.test')).toHaveLength(1); }); + + it('component body should pass `data-row-key`', () => { + const wrapper = mount( + } }} + data={[{ test: 'bamboo', key: 'light' }]} + />, + ); + + expect( + wrapper + .find('tr') + .last() + .props()['data-row-key'], + ).toEqual('light'); + }); }); diff --git a/tests/__snapshots__/ExpandRow.spec.js.snap b/tests/__snapshots__/ExpandRow.spec.js.snap index 880dabf1b..72d4645fe 100644 --- a/tests/__snapshots__/ExpandRow.spec.js.snap +++ b/tests/__snapshots__/ExpandRow.spec.js.snap @@ -36,6 +36,7 @@ exports[`Table.Expand childrenColumnName 1`] = ` >