From f350c1d9d24964f83f385af4391dd61ed2b72025 Mon Sep 17 00:00:00 2001 From: rmccar <42928680+rmccar@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:38:39 +0000 Subject: [PATCH] Fix lighthouse address input test (#3405) --- src/components/autosuggest/autosuggest.spec.js | 4 +++- src/components/autosuggest/autosuggest.ui.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/autosuggest/autosuggest.spec.js b/src/components/autosuggest/autosuggest.spec.js index 7948fd4a71..b7525f6eb0 100644 --- a/src/components/autosuggest/autosuggest.spec.js +++ b/src/components/autosuggest/autosuggest.spec.js @@ -609,6 +609,8 @@ describe('script: autosuggest', () => { expect(resultsItemCount).toBe(1); const warningText = await page.$eval('.ons-autosuggest__warning', (node) => node.textContent); expect(warningText.trim()).toBe('!Sorry, there is a problem.'); + const warningContainer = await page.$eval('.ons-autosuggest__warning', (node) => node.id); + expect(warningContainer).toBe('country-of-birth-listbox'); }); it('the list and results element should be removed from the page', async () => { @@ -657,7 +659,7 @@ describe('script: autosuggest', () => { await page.type('.ons-js-autosuggest-input', 'England', { delay: 20 }); await page.keyboard.press('ArrowUp'); await page.keyboard.press('Enter'); - // Defocus the autosuggest input. + // Unfocus the autosuggest input await page.keyboard.press('Tab'); await page.focus('.ons-js-autosuggest-input'); diff --git a/src/components/autosuggest/autosuggest.ui.js b/src/components/autosuggest/autosuggest.ui.js index c91c7b826f..1a19883df5 100644 --- a/src/components/autosuggest/autosuggest.ui.js +++ b/src/components/autosuggest/autosuggest.ui.js @@ -511,6 +511,7 @@ export default class AutosuggestUI { const warningSpanElement = document.createElement('span'); const warningBodyElement = document.createElement('div'); + warningContainer.id = this.listbox.getAttribute('id'); warningContainer.className = 'ons-autosuggest__warning'; warningElement.className = 'ons-panel ons-panel--warn ons-autosuggest__panel';