Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make table header sticky #5630

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/components/ResizeTable/ResizeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function ResizeTable({
...restProps,
components: { header: { cell: ResizableHeader } },
columns: mergedColumns,
sticky: true,
};

set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,13 @@ exports[`Table panel wrappper tests table should render fine with the query resp
class="ant-table-container"
>
<div
class="ant-table-content"
style="overflow-x: auto; overflow-y: hidden;"
class="ant-table-header ant-table-sticky-holder"
style="overflow: hidden; top: 0px;"
>
<table
style="width: auto; min-width: 100%; table-layout: fixed;"
style="table-layout: fixed; visibility: hidden;"
>
<colgroup>
<col
style="width: 145px;"
/>
<col
style="width: 145px;"
/>
</colgroup>
<colgroup />
<thead
class="ant-table-thead"
>
Expand Down Expand Up @@ -222,6 +215,23 @@ exports[`Table panel wrappper tests table should render fine with the query resp
</th>
</tr>
</thead>
</table>
</div>
<div
class="ant-table-body"
style="overflow-x: auto; overflow-y: hidden;"
>
<table
style="width: auto; min-width: 100%; table-layout: fixed;"
>
<colgroup>
<col
style="width: 145px;"
/>
<col
style="width: 145px;"
/>
</colgroup>
<tbody
class="ant-table-tbody"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ describe('ServicesTraces', () => {
const secondServiceName = await screen.findByText(/TestCustomerService/i);
expect(secondServiceName).toBeInTheDocument();
const allRow = screen.getAllByRole('row');
expect(allRow).toHaveLength(3);
expect(allRow[1].innerHTML).toContain('TestService');
expect(allRow[2].innerHTML).toContain('TestCustomerService');
expect(allRow).toHaveLength(2);
expect(allRow[0].innerHTML).toContain('TestService');
expect(allRow[1].innerHTML).toContain('TestCustomerService');

const tableHeader = await screen.findAllByRole('columnheader');
expect(tableHeader).toHaveLength(4);

fireEvent.click(tableHeader[1]);

const allSortedRowAsc = screen.getAllByRole('row');
expect(allSortedRowAsc).toHaveLength(3);
expect(allSortedRowAsc[1].innerHTML).toContain('TestService');
expect(allSortedRowAsc).toHaveLength(2);
expect(allSortedRowAsc[0].innerHTML).toContain('TestService');

fireEvent.click(tableHeader[1]);
const allSortedRowDsc = screen.getAllByRole('row');
expect(allSortedRowDsc).toHaveLength(3);
expect(allSortedRowDsc[1].innerHTML).toContain('TestCustomerService');
expect(allSortedRowDsc).toHaveLength(2);
expect(allSortedRowDsc[0].innerHTML).toContain('TestCustomerService');
});
});
Loading