msyavuz commented on code in PR #35277:
URL: https://github.com/apache/superset/pull/35277#discussion_r2382874580
##########
superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx:
##########
@@ -206,3 +206,65 @@ test('Bulk selection should work with pagination', () => {
const checkboxes = screen.getAllByRole('checkbox');
expect(checkboxes.length).toBeGreaterThan(0);
});
+
+test('handleTableChange should convert array field to dot notation for nested
fields', () => {
+ const setSortBy = jest.fn();
+ const sortingProps = {
+ ...defaultProps,
+ setSortBy,
+ };
+
+ render(<TableCollection {...sortingProps} />);
+
+ expect(screen.getByRole('table')).toBeInTheDocument();
+
+ const mockSorter = {
+ field: ['database', 'database_name'], // Array format from AntD
+ order: 'descend' as const,
+ };
+
+ const handleTableChange = (
+ _pagination: any,
+ _filters: any,
+ sorter: { field: string | string[]; order: 'ascend' | 'descend' },
+ ) => {
+ if (sorter && sorter.field) {
+ const fieldId = Array.isArray(sorter.field)
+ ? sorter.field.join('.')
+ : sorter.field;
+
+ setSortBy([
+ {
+ id: fieldId,
+ desc: sorter.order === 'descend',
+ },
+ ]);
+ }
+ };
Review Comment:
This does the `implement same thing in test and test that` again (just one
level above) and still doesn't interact with the component
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]