Skip to content

Commit 1ae0459

Browse files
committed
Ensure all <tr> elements have tbody, thead or tfoot parents
The latest Preact release warns about `<tr>` elements that have a `<table>` as their direct parent. See preactjs/preact#4375.
1 parent d00b812 commit 1ae0459

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

src/components/data/test/TableCell-test.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ describe('TableCell', () => {
1313
return mount(
1414
<TableContext.Provider value={tableContextValue}>
1515
<table>
16-
<TableSectionContext.Provider value={contextValue}>
17-
<tr>
18-
<TableCell {...props}>{props.children ?? 'Content'}</TableCell>
19-
</tr>
20-
</TableSectionContext.Provider>
16+
<tbody>
17+
<TableSectionContext.Provider value={contextValue}>
18+
<tr>
19+
<TableCell {...props}>{props.children ?? 'Content'}</TableCell>
20+
</tr>
21+
</TableSectionContext.Provider>
22+
</tbody>
2123
</table>
2224
</TableContext.Provider>,
2325
);
@@ -28,9 +30,11 @@ describe('TableCell', () => {
2830
const contentFn = (Component, props = {}) => {
2931
return mount(
3032
<table>
31-
<tr>
32-
<Component {...props} />
33-
</tr>
33+
<tbody>
34+
<tr>
35+
<Component {...props} />
36+
</tr>
37+
</tbody>
3438
</table>,
3539
);
3640
};

src/components/data/test/TableRow-test.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ describe('TableRow', () => {
1313
return mount(
1414
<TableContext.Provider value={tableContextValue}>
1515
<table>
16-
<TableSectionContext.Provider value={sectionContextValue}>
17-
<TableRow {...props}>
18-
<td>Cell content</td>
19-
</TableRow>
20-
</TableSectionContext.Provider>
16+
<tbody>
17+
<TableSectionContext.Provider value={sectionContextValue}>
18+
<TableRow {...props}>
19+
<td>Cell content</td>
20+
</TableRow>
21+
</TableSectionContext.Provider>
22+
</tbody>
2123
</table>
2224
</TableContext.Provider>,
2325
);
@@ -28,9 +30,11 @@ describe('TableRow', () => {
2830
const contentFn = (Component, props = {}) => {
2931
return mount(
3032
<table>
31-
<Component {...props}>
32-
<td>Cell content</td>
33-
</Component>
33+
<tbody>
34+
<Component {...props}>
35+
<td>Cell content</td>
36+
</Component>
37+
</tbody>
3438
</table>,
3539
);
3640
};

0 commit comments

Comments
 (0)