Skip to content

Commit b733f4c

Browse files
fix(AnalyticalTable): fix pre-selection of custom row ids and update react-table (#649)
1 parent 19cf697 commit b733f4c

File tree

7 files changed

+481
-55
lines changed

7 files changed

+481
-55
lines changed

packages/main/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"lodash.debounce": "^4.0.8",
3737
"react-content-loader": "5.1.0",
3838
"react-jss": "10.1.1",
39-
"react-table": "7.3.3",
39+
"react-table": "7.5.0",
4040
"react-virtual": "2.2.1"
4141
},
4242
"peerDependencies": {

packages/main/src/components/AnalyticalTable/AnalyticalTable.test.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,5 +311,28 @@ describe('AnalyticalTable', () => {
311311
expect(wrapper.render()).toMatchSnapshot();
312312
});
313313

314+
test('highlight row with custom row key', () => {
315+
const utils = render(
316+
<AnalyticalTable
317+
selectionMode={TableSelectionMode.SINGLE_SELECT}
318+
data={data}
319+
columns={columns}
320+
reactTableOptions={{
321+
getRowId: (row, relativeIndex, parent) => {
322+
return `${row.name ?? relativeIndex}`;
323+
}
324+
}}
325+
selectedRowIds={{
326+
['Fra']: true
327+
}}
328+
/>
329+
);
330+
331+
expect(utils.asFragment()).toMatchSnapshot();
332+
333+
const row = screen.getByText('Fra').parentNode.parentNode;
334+
expect(row).toHaveAttribute('data-is-selected');
335+
});
336+
314337
createPassThroughPropsTest(AnalyticalTable);
315338
});

0 commit comments

Comments
 (0)