diff --git a/cypress/e2e/search/actions.spec.ts b/cypress/e2e/search/actions.spec.ts index 69142899b..a3057fb64 100644 --- a/cypress/e2e/search/actions.spec.ts +++ b/cypress/e2e/search/actions.spec.ts @@ -111,6 +111,10 @@ describe('Search', () => { cy.typeQueryNotMatching(); cy.contains('No results for').should('be.visible'); }); + + it('should not refer to Recent/Favorite in aria-controls', () => { + cy.get('.DocSearch-Input').should('not.have.attr', 'aria-controls'); + }); }); describe('Recent and Favorites', () => { @@ -144,4 +148,26 @@ describe('Recent and Favorites', () => { cy.get('#docsearch-favoriteSearches-item-0').find('[title="Remove this search from favorites"]').trigger('click'); cy.contains('No recent searches').should('be.visible'); }); + + it('Input controls Recent and Favorite lists', () => { + // Mark one result as favorite + cy.get('#docsearch-recentSearches-item-0').find('[title="Save this search"]').trigger('click'); + cy.contains('Favorite').should('be.visible'); + // Search for something else to add a new recent search + cy.typeQueryMatching(); + cy.get('#docsearch-hits1-item-5 > a').click({ force: true }).wait(1000); + + cy.openModal(); + cy.contains('Recent').should('be.visible'); + cy.contains('Favorite').should('be.visible'); + + // Make sure the specified elements exist + cy.get('.DocSearch-Input') + .invoke('attr', 'aria-controls') + .then((value) => { + const ids = value!.split(' '); + expect(ids).to.have.length(2); + ids.forEach((id) => cy.get(`#${id}`).should('exist')); + }); + }); }); diff --git a/packages/docsearch-react/package.json b/packages/docsearch-react/package.json index 239ec65ee..90e962706 100644 --- a/packages/docsearch-react/package.json +++ b/packages/docsearch-react/package.json @@ -36,8 +36,8 @@ "watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\"" }, "dependencies": { - "@algolia/autocomplete-core": "1.17.9", - "@algolia/autocomplete-preset-algolia": "1.17.9", + "@algolia/autocomplete-core": "1.18.1", + "@algolia/autocomplete-preset-algolia": "1.18.1", "@docsearch/css": "3.8.3", "algoliasearch": "^5.14.2" }, diff --git a/packages/docsearch-react/src/Results.tsx b/packages/docsearch-react/src/Results.tsx index 1a46e8892..caee3baf3 100644 --- a/packages/docsearch-react/src/Results.tsx +++ b/packages/docsearch-react/src/Results.tsx @@ -28,7 +28,7 @@ export function Results(props: ResultsProps
{props.title}
-