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

test: fix validateDOMNesting warning #7508

Merged
merged 10 commits into from
Feb 5, 2024
13 changes: 0 additions & 13 deletions scripts/jest/setup/throw_on_console_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,5 @@ console.error = (message, ...rest) => {
return;
}

// Print React validateDOMNesting warning as a console.warn instead
// of throwing an error.
// TODO: Remove when edge-case DOM nesting is fixed in all components
if (
typeof message === 'string' &&
message.startsWith(
'Warning: validateDOMNesting(...): %s cannot appear as a child of <%s>'
)
) {
console.warn(message, ...rest);
return;
}

throw new Error(format(message, ...rest));
};
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiTableFooter is rendered 1`] = `
<div>
<table>
<tfoot
aria-label="aria-label"
class="testClass1 testClass2 emotion-euiTestCss"
data-test-subj="test subject string"
>
<tr>
children
<td>
children
</td>
</tr>
</tfoot>
</div>
</table>
`;
256 changes: 152 additions & 104 deletions src/components/table/__snapshots__/table_footer_cell.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,129 +1,177 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiTableFooterCell align defaults to left 1`] = `
<td
class="euiTableFooterCell"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
/>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
/>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell align renders center when specified 1`] = `
<td
class="euiTableFooterCell"
>
<div
class="euiTableCellContent euiTableCellContent--alignCenter"
>
<span
class="euiTableCellContent__text"
/>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
>
<div
class="euiTableCellContent euiTableCellContent--alignCenter"
>
<span
class="euiTableCellContent__text"
/>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell align renders right when specified 1`] = `
<td
class="euiTableFooterCell"
>
<div
class="euiTableCellContent euiTableCellContent--alignRight"
>
<span
class="euiTableCellContent__text"
/>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
>
<div
class="euiTableCellContent euiTableCellContent--alignRight"
>
<span
class="euiTableCellContent__text"
/>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell is rendered 1`] = `
<td
aria-label="aria-label"
class="euiTableFooterCell testClass1 testClass2 emotion-euiTestCss"
data-test-subj="test subject string"
>
<div
class="euiTableCellContent testClass1 testClass2 emotion-euiTestCss"
>
<span
class="euiTableCellContent__text"
>
children
</span>
</div>
</td>
<table>
<tfoot>
<tr>
<td
aria-label="aria-label"
class="euiTableFooterCell testClass1 testClass2 emotion-euiTestCss"
data-test-subj="test subject string"
>
<div
class="euiTableCellContent testClass1 testClass2 emotion-euiTestCss"
>
<span
class="euiTableCellContent__text"
>
children
</span>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell width and style accepts style attribute 1`] = `
<td
class="euiTableFooterCell"
style="width: 20%;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
style="width: 20%;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell width and style accepts width attribute 1`] = `
<td
class="euiTableFooterCell"
style="width: 10%;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
style="width: 10%;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell width and style accepts width attribute as number 1`] = `
<td
class="euiTableFooterCell"
style="width: 100px;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
style="width: 100px;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
</tr>
</tfoot>
</table>
`;

exports[`EuiTableFooterCell width and style resolves style and width attribute 1`] = `
<td
class="euiTableFooterCell"
style="width: 10%;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
<table>
<tfoot>
<tr>
<td
class="euiTableFooterCell"
style="width: 10%;"
>
<div
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
>
Test
</span>
</div>
</td>
</tr>
</tfoot>
</table>
`;
40 changes: 22 additions & 18 deletions src/components/table/__snapshots__/table_header.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiTableHeader is rendered 1`] = `
<thead
aria-label="aria-label"
class="testClass1 testClass2 emotion-euiTestCss"
data-test-subj="test subject string"
>
<tr>
<td>
children
</td>
</tr>
</thead>
<table>
<thead
aria-label="aria-label"
class="testClass1 testClass2 emotion-euiTestCss"
data-test-subj="test subject string"
>
<tr>
<td>
children
</td>
</tr>
</thead>
</table>
`;

exports[`EuiTableHeader is rendered without <tr> 1`] = `
<thead>
<tr>
<td>
children
</td>
</tr>
</thead>
<table>
<thead>
<tr>
<td>
children
</td>
</tr>
</thead>
</table>
`;
Loading
Loading