diff --git a/packages/atomic/cypress/e2e/search-box/search-box.cypress.ts b/packages/atomic/cypress/e2e/search-box/search-box.cypress.ts index e925f91392c..68369e882be 100644 --- a/packages/atomic/cypress/e2e/search-box/search-box.cypress.ts +++ b/packages/atomic/cypress/e2e/search-box/search-box.cypress.ts @@ -487,6 +487,16 @@ describe('Search Box Test Suites', () => { .and('contain', 'active-suggestion'); }); + it('should collapse suggestions when clicking on the search button', () => { + SearchBoxSelectors.inputBox().focus(); + SearchBoxSelectors.querySuggestions().should('exist'); + + SearchBoxSelectors.submitButton().click(); + cy.wait(TestFixture.interceptAliases.Search); + + SearchBoxSelectors.querySuggestions().should('not.exist'); + }); + CommonAssertions.assertConsoleError(false); }); diff --git a/packages/atomic/src/components/search/atomic-search-box/atomic-search-box.tsx b/packages/atomic/src/components/search/atomic-search-box/atomic-search-box.tsx index 780c8f273f0..088e6956e55 100644 --- a/packages/atomic/src/components/search/atomic-search-box/atomic-search-box.tsx +++ b/packages/atomic/src/components/search/atomic-search-box/atomic-search-box.tsx @@ -867,7 +867,10 @@ export class AtomicSearchBox { this.searchBox.submit()} + onClick={() => { + this.searchBox.submit(); + this.clearSuggestions(); + }} title={searchLabel} /> {this.renderSuggestions()}