From 814152f594866b257b47acad2b2df9d311d7392c Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Thu, 25 Feb 2021 10:13:55 -0800 Subject: [PATCH] [PR feedback] Add test --- .../curation_queries/curation_queries.test.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curation_queries/curation_queries.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curation_queries/curation_queries.test.tsx index 987031db45979..e55b944f7bebc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curation_queries/curation_queries.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curation_queries/curation_queries.test.tsx @@ -67,6 +67,18 @@ describe('CurationQueries', () => { expect(actions.addQuery).toHaveBeenCalled(); }); + it('disables the add button if any query fields are empty', () => { + setMockValues({ + ...values, + queries: ['a', '', 'c'], + hasEmptyQueries: true, + }); + const wrapper = shallow(); + const button = wrapper.find('[data-test-subj="addCurationQueryButton"]'); + + expect(button.prop('isDisabled')).toEqual(true); + }); + it('calls the passed onSubmit callback when the submit button is clicked', () => { setMockValues({ ...values, queries: ['some query'] }); const wrapper = shallow();