From 6c559ac9a37bac03d523440d8fe20be72ce7511f Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Thu, 18 Mar 2021 11:33:15 -0700 Subject: [PATCH] PR feedback: reset search query on flyout re-open --- .../curations/curation/results/add_result_logic.test.ts | 5 +++-- .../curations/curation/results/add_result_logic.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts index bed4794723449..a722ab96fc574 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts @@ -43,14 +43,15 @@ describe('AddResultLogic', () => { describe('actions', () => { describe('openFlyout', () => { - it('sets isFlyoutOpen to true', () => { - mount({ isFlyoutOpen: false }); + it('sets isFlyoutOpen to true and resets the searchQuery term', () => { + mount({ isFlyoutOpen: false, searchQuery: 'a previous search' }); AddResultLogic.actions.openFlyout(); expect(AddResultLogic.values).toEqual({ ...DEFAULT_VALUES, isFlyoutOpen: true, + searchQuery: '', }); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.ts index c7e522c3e3900..808f4c86971ee 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.ts @@ -54,6 +54,7 @@ export const AddResultLogic = kea query, + openFlyout: () => '', }, ], searchResults: [