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

[htmlIdGenerator] testenv mock #4212

Merged
merged 5 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions scripts/jest/setup/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@
jest.mock('./../../../src/components/icon', () => {
const { EuiIcon } = require('./../../../src/components/icon/icon.testenv');
return { EuiIcon }
});

jest.mock('./../../../src/services/accessibility', () => {
const a11y = jest.requireActual('./../../../src/services/accessibility');
const { htmlIdGenerator } = require('./../../../src/services/accessibility/html_id_generator.testenv');
return { ...a11y, htmlIdGenerator }
});
4 changes: 0 additions & 4 deletions src/components/accordion/accordion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import { requiredProps } from '../../test/required_props';

import { EuiAccordion } from './accordion';

jest.mock('./../../services/accessibility', () => ({
htmlIdGenerator: () => () => 'generated-id',
}));

let id = 0;
const getId = () => `${id++}`;

Expand Down
76 changes: 38 additions & 38 deletions src/components/basic_table/__snapshots__/basic_table.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`EuiBasicTable cellProps renders cells with custom props from a callback
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -144,7 +144,7 @@ exports[`EuiBasicTable cellProps renders rows with custom props from an object 1
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -270,7 +270,7 @@ exports[`EuiBasicTable empty is rendered 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -338,7 +338,7 @@ exports[`EuiBasicTable empty renders a node as a custom message 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -414,7 +414,7 @@ exports[`EuiBasicTable empty renders a string as a custom message 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -482,7 +482,7 @@ exports[`EuiBasicTable footers do not render without a column footer definition
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -716,7 +716,7 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -984,7 +984,7 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -1018,7 +1018,7 @@ exports[`EuiBasicTable itemIdToExpandedRowMap renders an expanded row 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -1147,7 +1147,7 @@ exports[`EuiBasicTable rowProps renders rows with custom props from a callback 1
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -1277,7 +1277,7 @@ exports[`EuiBasicTable rowProps renders rows with custom props from an object 1`
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -1504,13 +1504,13 @@ exports[`EuiBasicTable with initial selection 1`] = `
</div>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
<table
className="euiTable euiTable--responsive"
id="generated-id"
id="__table_generated-id"
tabIndex={-1}
>
<EuiScreenReaderOnly>
Expand Down Expand Up @@ -1923,7 +1923,7 @@ exports[`EuiBasicTable with multiple record actions with custom availability 1`]
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -2232,7 +2232,7 @@ exports[`EuiBasicTable with pagination - 2nd page 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -2310,7 +2310,7 @@ exports[`EuiBasicTable with pagination - 2nd page 1`] = `
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -2344,7 +2344,7 @@ exports[`EuiBasicTable with pagination 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -2440,7 +2440,7 @@ exports[`EuiBasicTable with pagination 1`] = `
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -2474,7 +2474,7 @@ exports[`EuiBasicTable with pagination and error 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -2557,7 +2557,7 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -2696,7 +2696,7 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -2730,7 +2730,7 @@ exports[`EuiBasicTable with pagination, hiding the per page options 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -2826,7 +2826,7 @@ exports[`EuiBasicTable with pagination, hiding the per page options 1`] = `
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -2882,7 +2882,7 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -3024,7 +3024,7 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -3079,7 +3079,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -3314,7 +3314,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -3369,7 +3369,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -3511,7 +3511,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -3566,7 +3566,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -3708,7 +3708,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -3763,7 +3763,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -4016,7 +4016,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -4071,7 +4071,7 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -4213,7 +4213,7 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
</EuiTable>
</div>
<PaginationBar
aria-controls="generated-id"
aria-controls="__table_generated-id"
onPageChange={[Function]}
onPageSizeChange={[Function]}
pagination={
Expand Down Expand Up @@ -4247,7 +4247,7 @@ exports[`EuiBasicTable with sortable columns and sorting disabled 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -4376,7 +4376,7 @@ exports[`EuiBasicTable with sorting 1`] = `
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down Expand Up @@ -4508,7 +4508,7 @@ exports[`EuiBasicTable with sorting enabled and enable all columns for sorting 1
</EuiFlexGroup>
</EuiTableHeaderMobile>
<EuiTable
id="generated-id"
id="__table_generated-id"
responsive={true}
tableLayout="fixed"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ exports[`DefaultItemAction render - icon 1`] = `
position="top"
>
<EuiButtonIcon
aria-labelledby="random_id"
aria-labelledby="generated-id"
color="primary"
iconType="trash"
isDisabled={false}
onClick={[Function]}
/>
<EuiScreenReaderOnly>
<span
id="random_id"
id="generated-id"
>
<span>
action1
Expand Down
Loading