Skip to content

Commit

Permalink
Table Component Rounded Corners Fix (#3010)
Browse files Browse the repository at this point in the history
* Adds missing class for rounded corner effect

* Adds test to check for that rounded classes also include overflow hidden
  • Loading branch information
jagabomb authored Sep 26, 2024
1 parent 8b66172 commit 64c1928
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions assets/js/common/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@ function Table({
})}
>
<div
className={classNames('min-w-fit shadow rounded-b-lg', {
'rounded-t-lg': !hasFilters,
})}
className={classNames(
'min-w-fit shadow overflow-hidden rounded-b-lg',
{
'rounded-t-lg': !hasFilters,
}
)}
>
{header}
<table className="min-w-full leading-normal table-fixed">
Expand Down
10 changes: 10 additions & 0 deletions assets/js/common/Table/Table.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ describe('Table component', () => {
.forEach((tableRow) => expect(tableRow).toHaveClass(pxClass));
});

it('should have wrapper div classes with rounded and overflow hidden', () => {
const data = tableDataFactory.buildList(10);

render(<Table config={tableConfig} data={data} />);

const wrapperDiv = screen.getByRole('table').closest('div');

expect(wrapperDiv).toHaveClass(/rounded/, 'overflow-hidden');
});

describe('filtering', () => {
it('should filter by the chosen filter option with default filter', async () => {
const data = tableDataFactory.buildList(10);
Expand Down

0 comments on commit 64c1928

Please sign in to comment.