Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Liooo committed Oct 20, 2024
1 parent ffa2b23 commit c3068ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function Cell<R, SR>(

const CellComponent = memo(forwardRef(Cell)) as <R, SR>(
props: CellRendererProps<R, SR> & RefAttributes<HTMLDivElement>
) => JSX.Element;
) => React.JSX.Element;

export default CellComponent;

Expand Down
18 changes: 13 additions & 5 deletions test/browser/renderers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { getCells, getHeaderCells, getRows, setup } from './utils';

interface Row {
id: number;
col1?: string;
col2?: string;
col1: string;
col2: string;
}

const noRows: readonly Row[] = [];
Expand Down Expand Up @@ -131,21 +131,29 @@ test('fallback defined using both provider and renderers with no rows', () => {
});

test('fallback defined using renderers prop with a row', () => {
setup({ columns, rows: [{ id: 1 }], renderers: { noRowsFallback: <NoRowsFallback /> } });
setup({
columns,
rows: [{ id: 1, col1: 'col 1 value', col2: 'col 2 value' }],
renderers: { noRowsFallback: <NoRowsFallback /> }
});

expect(getRows()).toHaveLength(1);
expect(screen.queryByText('Local no rows fallback')).not.toBeInTheDocument();
});

test('fallback defined using provider with a row', () => {
setupProvider({ columns, rows: [{ id: 1 }] });
setupProvider({ columns, rows: [{ id: 1, col1: 'col 1 value', col2: 'col 2 value' }] });

expect(getRows()).toHaveLength(1);
expect(screen.queryByText('Global no rows fallback')).not.toBeInTheDocument();
});

test('fallback defined using both provider and renderers with a row', () => {
setupProvider({ columns, rows: [{ id: 1 }], renderers: { noRowsFallback: <NoRowsFallback /> } });
setupProvider({
columns,
rows: [{ id: 1, col1: 'col 1 value', col2: 'col 2 value' }],
renderers: { noRowsFallback: <NoRowsFallback /> }
});

expect(getRows()).toHaveLength(1);
expect(screen.queryByText('Global no rows fallback')).not.toBeInTheDocument();
Expand Down

0 comments on commit c3068ef

Please sign in to comment.