Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
precious-onyenaucheya-ons committed Sep 19, 2023
1 parent 1cfb9de commit 2fc7a1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/components/autosuggest/autosuggest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,12 @@ describe('script: autosuggest', () => {
expect(warningText.trim()).toBe('!Sorry, there is a problem.');
});

it('the results list and title elements should be removed from the page', async () => {
expect($('.ons-js-autosuggest-listbox').length).toBe(0);
expect($('.ons-autosuggest__results-title').length).toBe(0);
it('the list and results element should be removed from the page', async () => {
const hasListBox = await page.$eval('.ons-autosuggest', (node) => node.classList.contains('.ons-js-autosuggest-listbox'));
const hasResultsTitle = await page.$eval('.ons-autosuggest', (node) => node.classList.contains('.ons-autosuggest__results-title'));

expect(hasListBox).toBe(false);
expect(hasResultsTitle).toBe(false);
});

it('the input should be disabled', async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/components/autosuggest/autosuggest.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class AutosuggestUI {
this.input = context.querySelector(`.${baseClass}-input`);
this.resultsContainer = context.querySelector(`.${baseClass}-results`);
this.listbox = this.resultsContainer.querySelector(`.${baseClass}-listbox`);
this.resultsTitleContainer = this.resultsContainer.querySelector(`.${baseClass}__results-title`);
this.resultsTitleContainer = this.resultsContainer.querySelector(`.ons-autosuggest__results-title`);
this.instructions = context.querySelector(`.${baseClass}-instructions`);
this.ariaStatus = context.querySelector(`.${baseClass}-aria-status`);
this.form = context.closest('form');
Expand Down Expand Up @@ -418,7 +418,6 @@ export default class AutosuggestUI {
this.input.value = '';
this.label.classList.add('ons-u-lighter');

this.listbox.innerHTML = '';
this.resultsContainer.insertBefore(this.createWarningElement(message), this.resultsContainer.firstChild);
this.ariaStatus.setAttribute('aria-hidden', 'true');
this.setAriaStatus(ariaMessage);
Expand Down

0 comments on commit 2fc7a1f

Please sign in to comment.