msyavuz commented on code in PR #35277:
URL: https://github.com/apache/superset/pull/35277#discussion_r2383138920
##########
superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx:
##########
@@ -206,3 +206,35 @@ test('Bulk selection should work with pagination', () => {
const checkboxes = screen.getAllByRole('checkbox');
expect(checkboxes.length).toBeGreaterThan(0);
});
+
+test('should call setSortBy when clicking sortable column header', () => {
+ const setSortBy = jest.fn();
+ const sortingProps = {
+ ...defaultProps,
+ setSortBy,
+ };
+
+ render(<TableCollection {...sortingProps} />);
+
+ const columnHeaders = screen.getAllByRole('columnheader');
+ expect(columnHeaders.length).toBeGreaterThan(0);
+
+ const firstColumnHeader = columnHeaders[0];
+ expect(firstColumnHeader).toBeInTheDocument();
+
+ // Click on the column header to trigger sorting
+ fireEvent.click(firstColumnHeader);
Review Comment:
I remember a discussion about using `userEvent` vs `fireEvent` but i think
this is fine.
--
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]