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 8f793ff907..839c77d14a 100644 --- a/src/components/autosuggest/autosuggest.ui.js +++ b/src/components/autosuggest/autosuggest.ui.js @@ -529,6 +529,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';