Skip to content

Commit

Permalink
fix(atomic-search-box): close suggestions when clicking search button (
Browse files Browse the repository at this point in the history
…#3448)

* fix(atomic-search-box): close suggestions when clicking search button

https://coveord.atlassian.net/browse/KIT-2921

* test(atomic-search-box): close suggestions when clicking search button

https://coveord.atlassian.net/browse/KIT-2921
  • Loading branch information
louis-bompart authored Dec 2, 2023
1 parent 1a23a51 commit 7cb5aa5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/atomic/cypress/e2e/search-box/search-box.cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,10 @@ export class AtomicSearchBox {
<Submit
bindings={this.bindings}
disabled={this.isSearchDisabled}
onClick={() => this.searchBox.submit()}
onClick={() => {
this.searchBox.submit();
this.clearSuggestions();
}}
title={searchLabel}
/>
{this.renderSuggestions()}
Expand Down

0 comments on commit 7cb5aa5

Please sign in to comment.