Skip to content

Commit

Permalink
[htmlIdGenerator] testenv mock (#4212)
Browse files Browse the repository at this point in the history
* htmlIdGenerator testenv mock

* update jest env

* CL
  • Loading branch information
thompsongl authored Nov 11, 2020
1 parent 3f6ff37 commit cbb2601
Show file tree
Hide file tree
Showing 46 changed files with 229 additions and 321 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `30.3.0`.
- Added `testenv` mock for `htmlIdGenerator` ([#4212](https://github.com/elastic/eui/pull/4212))

## [`30.3.0`](https://github.com/elastic/eui/tree/v30.3.0)

Expand Down
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

0 comments on commit cbb2601

Please sign in to comment.