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

fix(table): cover and clean #103

Merged
merged 1 commit into from
Jan 21, 2024
Merged
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
2 changes: 0 additions & 2 deletions scripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ const pathsDelete = [
'./src/pages/Home/Galleries',
'./src/assets',
'./src/shared/testsUtils/clearString.ts',
'./src/shared/toolkit.ts',
'./src/shared/components/LiveCode',
'./src/shared/components/Cards',
'./src/shared/components/LazyImage',
'./src/shared/components/DownloadLink',
'./src/shared/components/Editor',
'./src/shared/components/testsUtils/clearString.ts',
'./src/pages/Demos',
'./features/Demos',
'renovate.json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ describe('Header', () => {
within(baseElement).getByRole(scope === 'col' || scope === undefined ? 'columnheader' : 'rowheader');
screen.getByText('label');
});

it('Should render Header with class "af-table__th--blank" when isBlank is true', () => {
const { baseElement } = renderWithContainer(<Header isBlank />, container);

const header = within(baseElement).getByRole('columnheader');
expect(header).toHaveClass('af-table__th af-table__th--blank');
});

it('Should render Header without class "af-table__th--blank" when isBlank is false', () => {
const { baseElement } = renderWithContainer(<Header isBlank={false} />, container);

const header = within(baseElement).getByRole('columnheader');
expect(header).toHaveClass('af-table__th');
});
});
5 changes: 4 additions & 1 deletion src/shared/testsUtils/sharedScenarios/table/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export const expectTable = async (tableItemsType = DEFAULT_TABLE_ITEMS_TYPE) =>
};

export const expectCellsContent = (cells: HTMLElement[], ...args: string[]) => {
args
const argsWithoutLast = [...args];
argsWithoutLast.pop();

argsWithoutLast
.filter(item => !isNull(item))
.forEach((headerLabel, index) => {
expect(cells[index]).toHaveTextContent(RegExp(headerLabel));
Expand Down