Skip to content

Commit

Permalink
Add: Add renderer functions to render within tables
Browse files Browse the repository at this point in the history
Introduce new renderer function rendererWithTable and
rendererWithTableRow for testing purposes and avoid warnings when
rendering table row or table data elements.
  • Loading branch information
bjoernricks committed Mar 7, 2025
1 parent d6f549a commit 05d08a0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/web/utils/Testing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,31 @@ export const rendererWith = (
renderHook: hook => rtlRenderHook(hook, {wrapper}),
};
};

export const rendererWithTable = options => {
const {render, ...other} = rendererWith(options);
return {
...other,
render: element =>
render(
<table>
<tbody>{element}</tbody>
</table>,
),
};
};

Check warning on line 201 in src/web/utils/Testing.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/utils/Testing.jsx#L191-L201

Added lines #L191 - L201 were not covered by tests

export const rendererWithTableRow = options => {
const {render, ...other} = rendererWith(options);
return {
...other,
render: element =>
render(
<table>
<tbody>
<tr>{element}</tr>
</tbody>
</table>,
),
};
};

Check warning on line 216 in src/web/utils/Testing.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/utils/Testing.jsx#L204-L216

Added lines #L204 - L216 were not covered by tests

0 comments on commit 05d08a0

Please sign in to comment.