diff --git a/components/table/src/data-table/__tests__/data-table-row.test.js b/components/table/src/data-table/__tests__/data-table-row.test.js index 210358ca47..84638f9f63 100644 --- a/components/table/src/data-table/__tests__/data-table-row.test.js +++ b/components/table/src/data-table/__tests__/data-table-row.test.js @@ -140,4 +140,23 @@ describe('', () => { expect(cb).toHaveBeenCalledTimes(1) expect(cb).toHaveBeenCalledWith({ expanded: true }) }) + + it('accepts a hover prop', () => { + const cb = jest.fn() + const wrapper = mount( + + ) + + wrapper.find('tr').simulate('mouseover') + + wrapper.find('tr').simulate('click') + + expect(cb).toHaveBeenCalledTimes(2) + }) }) diff --git a/components/table/src/data-table/data-table-row/data-table-row.js b/components/table/src/data-table/data-table-row/data-table-row.js index d3b40b7e00..d29caa40a3 100644 --- a/components/table/src/data-table/data-table-row/data-table-row.js +++ b/components/table/src/data-table/data-table-row/data-table-row.js @@ -20,6 +20,7 @@ export const DataTableRow = forwardRef( draggable, role, onExpandToggle, + ...rest }, ref ) => { @@ -45,6 +46,7 @@ export const DataTableRow = forwardRef( selected={selected} draggable={draggable} role={role} + {...rest} > {draggable && } {expandableContent && ( diff --git a/components/table/src/table/table-row.js b/components/table/src/table/table-row.js index 13e3f63f49..3504beff7a 100644 --- a/components/table/src/table/table-row.js +++ b/components/table/src/table/table-row.js @@ -16,6 +16,7 @@ export const TableRow = ({ className, dataTest, suppressZebraStriping, + ...rest }) => { const { suppressZebraStriping: suppressZebraStripingFromContext } = useContext(TableContext) @@ -30,6 +31,7 @@ export const TableRow = ({ className={cx(className, { zebraStriping })} data-test={dataTest} role={role} + {...rest} > {children}