From bc35445a99396dcc9d69b798ff8e0e292723aec5 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Mon, 19 Aug 2024 16:10:40 -0700 Subject: [PATCH 01/21] Upgrade EUI to v95.8.0 --- package.json | 2 +- src/dev/license_checker/config.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 6e1a4a4a7f6ef..9a5aba2ed55b0 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "@elastic/ecs": "^8.11.1", "@elastic/elasticsearch": "^8.15.0", "@elastic/ems-client": "8.5.3", - "@elastic/eui": "95.7.0", + "@elastic/eui": "95.8.0-backport.1", "@elastic/filesaver": "1.1.2", "@elastic/node-crypto": "1.2.1", "@elastic/numeral": "^2.5.1", diff --git a/src/dev/license_checker/config.ts b/src/dev/license_checker/config.ts index 0ebeb9f0a518f..f46eca0012af8 100644 --- a/src/dev/license_checker/config.ts +++ b/src/dev/license_checker/config.ts @@ -86,7 +86,7 @@ export const LICENSE_OVERRIDES = { 'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts '@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint '@elastic/ems-client@8.5.3': ['Elastic License 2.0'], - '@elastic/eui@95.7.0': ['SSPL-1.0 OR Elastic License 2.0'], + '@elastic/eui@95.8.0-backport.1': ['SSPL-1.0 OR Elastic License 2.0'], 'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry 'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary '@bufbuild/protobuf@1.2.1': ['Apache-2.0'], // license (Apache-2.0 AND BSD-3-Clause) diff --git a/yarn.lock b/yarn.lock index c1855e9acef09..b190be5937504 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1772,10 +1772,10 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314" integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ== -"@elastic/eui@95.7.0": - version "95.7.0" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-95.7.0.tgz#50edc43d3aac1a1ea87ec56a04ec0bc91e7e32a1" - integrity sha512-T6tihdAtE3JhXaTMHagidXWB5Sv6c++5vHdPj7kyYGjT1fDPpJ/fuTZTfH2GJLc56g63zBdDNMkLnXZYb0ld4Q== +"@elastic/eui@95.8.0-backport.1": + version "95.8.0-backport.1" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-95.8.0-backport.1.tgz#2388aa246fd9a4058a5fd04d5e3b57c48be928ed" + integrity sha512-eHWG56JONn+mktUOriEY0fgJuLbFLKjHbbPYaCzbK6lMl2wfFm56JKFh4S3EpVyZDXEkf8OJnVT2lmJNDp5EIg== dependencies: "@hello-pangea/dnd" "^16.6.0" "@types/lodash" "^4.14.202" From 8d9b5fd3585901ae04a99608f8fb16bf2aeb163b Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Mon, 19 Aug 2024 16:23:29 -0700 Subject: [PATCH 02/21] i18n updates --- .../src/__snapshots__/i18n_service.test.tsx.snap | 1 + .../i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap b/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap index ca90bcbdb67ba..4f04a571c845b 100644 --- a/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap +++ b/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap @@ -140,6 +140,7 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiExternalLinkIcon.newTarget.screenReaderOnlyText": "(opens in a new tab or window)", "euiFieldPassword.maskPassword": "Mask password", "euiFieldPassword.showPassword": "Show password as plain text. Note: this will visually expose your password on the screen.", + "euiFieldSearch.clearSearchButtonLabel": "Clear search input", "euiFilePicker.filesSelected": [Function], "euiFilePicker.promptText": "Select or drag and drop a file", "euiFilePicker.removeSelected": "Remove", diff --git a/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx b/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx index 34e6ef5ab0380..b0ba2dfe7fcf8 100644 --- a/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx +++ b/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx @@ -725,6 +725,10 @@ export const getEuiContextMapping = (): EuiTokensObject => { 'euiFieldPassword.maskPassword': i18n.translate('core.euiFieldPassword.maskPassword', { defaultMessage: 'Mask password', }), + 'euiFieldSearch.clearSearchButtonLabel': i18n.translate( + 'core.euiFieldSearch.clearSearchButtonLabel', + { defaultMessage: 'Clear search input' } + ), 'euiFilePicker.removeSelectedAriaLabel': i18n.translate( 'core.euiFilePicker.removeSelectedAriaLabel', { From 0fa43c7b1f56024d8521644b17cc8510ae9dde51 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Tue, 20 Aug 2024 12:36:52 -0700 Subject: [PATCH 03/21] Fix Enzyme tests that require more specific selectors - caused by additional Emotion wrapper that matches the same selector --- .../kbn-test-jest-helpers/src/testbed/testbed.ts | 6 +++--- .../components/header_page/editable_title.test.tsx | 6 +++--- .../synchronization/blocked_window_item.test.tsx | 13 +++++++------ .../components/builder/entry_renderer.test.tsx | 2 +- .../privileges/es/index_privilege_form.test.tsx | 4 ++-- .../components/open_timeline/index.test.tsx | 6 +++--- .../servicenow_itsm/servicenow_itsm_params.test.tsx | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/packages/kbn-test-jest-helpers/src/testbed/testbed.ts b/packages/kbn-test-jest-helpers/src/testbed/testbed.ts index 4559924c28aff..52adf2c719ef6 100644 --- a/packages/kbn-test-jest-helpers/src/testbed/testbed.ts +++ b/packages/kbn-test-jest-helpers/src/testbed/testbed.ts @@ -231,11 +231,11 @@ export function registerTestBed { let errorMessagesWrappers: ReactWrapper; if (typeof wrapper === 'string') { - errorMessagesWrappers = find(wrapper).find('.euiFormErrorText'); + errorMessagesWrappers = find(wrapper).find('div.euiFormErrorText'); } else { errorMessagesWrappers = wrapper - ? wrapper.find('.euiFormErrorText') - : component.find('.euiFormErrorText'); + ? wrapper.find('div.euiFormErrorText') + : component.find('div.euiFormErrorText'); } return errorMessagesWrappers.map((err) => err.text()); }; diff --git a/x-pack/plugins/cases/public/components/header_page/editable_title.test.tsx b/x-pack/plugins/cases/public/components/header_page/editable_title.test.tsx index 50c672564b9d9..2bd3d22dfd675 100644 --- a/x-pack/plugins/cases/public/components/header_page/editable_title.test.tsx +++ b/x-pack/plugins/cases/public/components/header_page/editable_title.test.tsx @@ -229,7 +229,7 @@ describe('EditableTitle', () => { wrapper.find('button[data-test-subj="editable-title-submit-btn"]').simulate('click'); wrapper.update(); - expect(wrapper.find('.euiFormErrorText').text()).toBe( + expect(wrapper.find('div.euiFormErrorText').text()).toBe( 'The length of the title is too long. The maximum length is 160 characters.' ); @@ -256,7 +256,7 @@ describe('EditableTitle', () => { wrapper.find('button[data-test-subj="editable-title-submit-btn"]').simulate('click'); wrapper.update(); - expect(wrapper.find('.euiFormErrorText').text()).toBe('A name is required.'); + expect(wrapper.find('div.euiFormErrorText').text()).toBe('A name is required.'); expect(submitTitle).not.toHaveBeenCalled(); expect( @@ -284,7 +284,7 @@ describe('EditableTitle', () => { wrapper.find('button[data-test-subj="editable-title-submit-btn"]').simulate('click'); wrapper.update(); - expect(wrapper.find('.euiFormErrorText').text()).toBe( + expect(wrapper.find('div.euiFormErrorText').text()).toBe( 'The length of the title is too long. The maximum length is 160 characters.' ); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/blocked_window_item.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/blocked_window_item.test.tsx index e29ea8bbd15f6..0762426bf134b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/blocked_window_item.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/blocked_window_item.test.tsx @@ -75,28 +75,29 @@ describe('BlockedWindowItem', () => { it('handles "start" time change', () => { const wrapper = shallow(); - const dayRange = wrapper.find(EuiDatePickerRange).dive(); + const dayRange = wrapper.find(EuiDatePickerRange).dive().childAt(0).dive(); const rangeDelimiter = dayRange.find(EuiFormControlLayoutDelimited).dive(); rangeDelimiter + .find('.euiDatePickerRange__start') + .dive() .find(EuiDatePicker) - .first() .simulate('change', moment().utc().set({ hour: 10, minute: 0, seconds: 0 })); - expect(rangeDelimiter.find(EuiDatePicker)).toHaveLength(2); expect(setBlockedTimeWindow).toHaveBeenCalledWith(0, 'start', '10:00:00Z'); }); it('handles "end" time change', () => { const wrapper = shallow(); - const dayRange = wrapper.find(EuiDatePickerRange).dive(); + const dayRange = wrapper.find(EuiDatePickerRange).dive().childAt(0).dive(); const rangeDelimiter = dayRange.find(EuiFormControlLayoutDelimited).dive(); + rangeDelimiter + .find('.euiDatePickerRange__end') + .dive() .find(EuiDatePicker) - .last() .simulate('change', moment().utc().set({ hour: 12, minute: 0, seconds: 0 })); - expect(rangeDelimiter.find(EuiDatePicker)).toHaveLength(2); expect(setBlockedTimeWindow).toHaveBeenCalledWith(0, 'end', '12:00:00Z'); }); }); diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx index 0aaa47b4a1265..580a294f64d25 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx @@ -241,7 +241,7 @@ describe('BuilderEntryItem', () => { await waitFor(() => { wrapper.update(); - expect(wrapper.find('.euiFormHelpText.euiFormRow__text').text()).toMatch( + expect(wrapper.find('div.euiFormHelpText.euiFormRow__text').text()).toMatch( /This field is defined as different types across the following indices or is unmapped. This can cause unexpected query results./ ); }); diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx index dc7ebaf3b3069..10e179379c619 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx @@ -425,13 +425,13 @@ describe('field level security', () => { const wrapper = mountWithIntl(); expect(wrapper.find('div.indexPrivilegeForm__grantedFieldsRow')).toHaveLength(1); expect(wrapper.find('div.indexPrivilegeForm__deniedFieldsRow')).toHaveLength(1); - expect(wrapper.find('.euiFormHelpText')).toHaveLength(1); + expect(wrapper.find('div.euiFormHelpText')).toHaveLength(1); }); test('it does not display a warning when fields are granted', () => { const wrapper = mountWithIntl(); expect(wrapper.find('div.indexPrivilegeForm__grantedFieldsRow')).toHaveLength(1); expect(wrapper.find('div.indexPrivilegeForm__deniedFieldsRow')).toHaveLength(1); - expect(wrapper.find('.euiFormHelpText')).toHaveLength(0); + expect(wrapper.find('div.euiFormHelpText')).toHaveLength(0); }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx index 68f6071200ec1..812d59cc1296b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx @@ -363,7 +363,7 @@ describe('StatefulOpenTimeline', () => { await waitFor(() => { wrapper - .find('.euiCheckbox__input') + .find('input.euiCheckbox__input') .first() .simulate('change', { target: { checked: true } }); @@ -425,7 +425,7 @@ describe('StatefulOpenTimeline', () => { await waitFor(() => { wrapper - .find('.euiCheckbox__input') + .find('input.euiCheckbox__input') .first() .simulate('change', { target: { checked: true } }); @@ -637,7 +637,7 @@ describe('StatefulOpenTimeline', () => { await waitFor(() => { expect(getSelectedItem().length).toEqual(0); wrapper - .find('.euiCheckbox__input') + .find('input.euiCheckbox__input') .first() .simulate('change', { target: { checked: true } }); expect(getSelectedItem().length).toEqual(13); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.test.tsx index 0d1986ab9ceca..128fd6518277a 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.test.tsx @@ -377,7 +377,7 @@ describe('ServiceNowITSMParamsFields renders', () => { const wrapper = mountWithIntl(); - expect(wrapper.find('.euiFormErrorText').text()).toBe('correlation_id_error'); + expect(wrapper.find('div.euiFormErrorText').text()).toBe('correlation_id_error'); }); it('updates additional fields', async () => { From 9673ce2187bbadc1ddbc1b6c4755407c65f29a94 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Tue, 20 Aug 2024 14:07:59 -0700 Subject: [PATCH 04/21] Update Enzyme snapshots from EuiFormRow class->function component migration - default props are no longer read/rendered by enzyme's snapshotter --- .../screen_reader_a11y.test.tsx.snap | 1 - .../__snapshots__/save_modal.test.js.snap | 8 +- .../bytes/__snapshots__/bytes.test.tsx.snap | 5 - .../date/__snapshots__/date.test.tsx.snap | 5 - .../__snapshots__/date_nanos.test.tsx.snap | 5 - .../__snapshots__/duration.test.tsx.snap | 80 +------------ .../__snapshots__/histogram.test.tsx.snap | 10 -- .../number/__snapshots__/number.test.tsx.snap | 5 - .../__snapshots__/percent.test.tsx.snap | 5 - .../__snapshots__/static_lookup.test.tsx.snap | 10 -- .../string/__snapshots__/string.test.tsx.snap | 5 - .../__snapshots__/truncate.test.tsx.snap | 5 - .../__snapshots__/samples.test.tsx.snap | 5 - .../__snapshots__/tutorial.test.js.snap | 8 +- .../__snapshots__/controls_tab.test.tsx.snap | 10 -- .../list_control_editor.test.tsx.snap | 60 ---------- .../__snapshots__/options_tab.test.tsx.snap | 15 --- .../range_control_editor.test.tsx.snap | 10 -- .../vis/__snapshots__/form_row.test.tsx.snap | 15 --- .../saved_object_save_modal.test.tsx.snap | 40 ------- .../__snapshots__/flyout.test.tsx.snap | 10 -- .../__snapshots__/table.test.tsx.snap | 26 +---- .../extended_bounds.test.tsx.snap | 5 - .../__snapshots__/metric_agg.test.tsx.snap | 4 - .../controls/__snapshots__/size.test.tsx.snap | 4 - .../__snapshots__/time_interval.test.tsx.snap | 4 - .../__snapshots__/top_aggregate.test.tsx.snap | 4 - .../splits/__snapshots__/terms.test.js.snap | 30 ----- .../__snapshots__/point_options.test.tsx.snap | 4 - .../__snapshots__/y_extents.test.tsx.snap | 4 - .../flex_item_setting.test.js.snap | 8 -- .../pipeline_editor.test.js.snap | 110 ------------------ .../layer_template.test.tsx.snap | 16 +-- .../resolution_editor.test.tsx.snap | 16 --- .../update_source_editor.test.js.snap | 16 --- .../__snapshots__/scaling_form.test.tsx.snap | 32 +---- ...single_layer_source_settings.test.tsx.snap | 17 --- ...e_layer_vector_source_editor.test.tsx.snap | 5 - .../xyz_tms_editor.test.tsx.snap | 5 - ...ems_vector_tile_style_editor.test.tsx.snap | 4 - .../heatmap_style_editor.test.tsx.snap | 4 - .../vector_style_editor.test.tsx.snap | 8 -- .../label_position_editor.test.tsx.snap | 15 --- .../custom_icon_modal.test.tsx.snap | 20 ---- .../geo_index_pattern_select.test.tsx.snap | 5 - .../validated_number_input.test.tsx.snap | 10 -- .../geometry_filter_form.test.js.snap | 16 --- .../navigation_panel.test.tsx.snap | 55 +-------- .../__snapshots__/footer.test.tsx.snap | 4 - .../__snapshots__/list.test.tsx.snap | 69 ----------- .../__snapshots__/calendar_form.test.js.snap | 25 ---- .../add_item_popover.test.js.snap | 15 --- .../edit_description_popover.test.js.snap | 15 --- .../edit/__snapshots__/header.test.js.snap | 10 -- .../flyout/__snapshots__/flyout.test.js.snap | 25 ---- .../__snapshots__/login_form.test.tsx.snap | 10 -- .../elasticsearch_privileges.test.tsx.snap | 8 -- .../index_privilege_form.test.tsx.snap | 10 -- ...mote_cluster_privileges_form.test.tsx.snap | 10 -- .../simple_privilege_section.test.tsx.snap | 5 - .../customize_space.test.tsx.snap | 15 --- .../customize_space_avatar.test.tsx.snap | 15 --- .../common/expression_items/value.test.tsx | 80 ++++++------- 63 files changed, 53 insertions(+), 1027 deletions(-) diff --git a/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/screen_reader_a11y.test.tsx.snap b/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/screen_reader_a11y.test.tsx.snap index 66e9717bbc1f4..af2a055abc376 100644 --- a/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/screen_reader_a11y.test.tsx.snap +++ b/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/screen_reader_a11y.test.tsx.snap @@ -223,7 +223,6 @@ exports[`ScreenReaderRouteAnnouncements renders 1`] = `
- + } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > - + - + } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > - + - + - + } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > - + } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > @@ -23,7 +19,6 @@ exports[`renders control with warning 1`] = ` test control } - labelType="label" >
My Control @@ -34,13 +29,8 @@ exports[`renders control with warning 1`] = ` exports[`renders disabled control with tooltip 1`] = `
My Control diff --git a/src/plugins/saved_objects/public/save_modal/__snapshots__/saved_object_save_modal.test.tsx.snap b/src/plugins/saved_objects/public/save_modal/__snapshots__/saved_object_save_modal.test.tsx.snap index bdd9bc2ba609d..9a26b9bfecc0e 100644 --- a/src/plugins/saved_objects/public/save_modal/__snapshots__/saved_object_save_modal.test.tsx.snap +++ b/src/plugins/saved_objects/public/save_modal/__snapshots__/saved_object_save_modal.test.tsx.snap @@ -26,12 +26,8 @@ exports[`SavedObjectSaveModal should render matching snapshot 1`] = ` onSubmit={[Function]} > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" > } - labelType="label" >