diff --git a/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx b/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx index f517565434c18..686a201761dcd 100644 --- a/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx +++ b/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx @@ -85,6 +85,7 @@ export function mountWithIntl( childContextTypes, ...props }: { + attachTo?: HTMLElement; context?: any; childContextTypes?: ValidationMap; } = {} diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx index 7f2446c0625f8..e171c457c541e 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx @@ -22,7 +22,7 @@ import { generateId } from '../../../id_generator'; jest.mock('../../../id_generator'); -let container: HTMLDivElement | null; +let container: HTMLDivElement | undefined; beforeEach(() => { container = document.createElement('div'); @@ -35,7 +35,7 @@ afterEach(() => { container.parentNode.removeChild(container); } - container = null; + container = undefined; }); describe('ConfigPanel', () => { @@ -121,11 +121,9 @@ describe('ConfigPanel', () => { describe('focus behavior when adding or removing layers', () => { it('should focus the only layer when resetting the layer', () => { - const component = mountWithIntl( - , - // @ts-expect-error - { attachTo: container } - ); + const component = mountWithIntl(, { + attachTo: container, + }); const firstLayerFocusable = component .find(LayerPanel) .first() @@ -146,11 +144,7 @@ describe('ConfigPanel', () => { first: mockDatasource.publicAPIMock, second: mockDatasource.publicAPIMock, }; - const component = mountWithIntl( - , - // @ts-expect-error - { attachTo: container } - ); + const component = mountWithIntl(, { attachTo: container }); const secondLayerFocusable = component .find(LayerPanel) .at(1) @@ -171,11 +165,7 @@ describe('ConfigPanel', () => { first: mockDatasource.publicAPIMock, second: mockDatasource.publicAPIMock, }; - const component = mountWithIntl( - , - // @ts-expect-error - { attachTo: container } - ); + const component = mountWithIntl(, { attachTo: container }); const firstLayerFocusable = component .find(LayerPanel) .first() @@ -197,11 +187,9 @@ describe('ConfigPanel', () => { } }); - const component = mountWithIntl( - , - // @ts-expect-error - { attachTo: container } - ); + const component = mountWithIntl(, { + attachTo: container, + }); act(() => { component.find('[data-test-subj="lnsLayerAddButton"]').first().simulate('click'); }); diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx index 1aed774fa2572..2c850d0b4472c 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx @@ -23,7 +23,7 @@ import { jest.mock('../../../id_generator'); -let container: HTMLDivElement | null; +let container: HTMLDivElement | undefined; beforeEach(() => { container = document.createElement('div'); @@ -36,7 +36,7 @@ afterEach(() => { container.parentNode.removeChild(container); } - container = null; + container = undefined; }); const defaultContext = { @@ -659,7 +659,6 @@ describe('LayerPanel', () => { , - // @ts-expect-error { attachTo: container } ); act(() => {