Loading src/a11y.autocomplete.js +2 −1 Original line number Diff line number Diff line Loading @@ -126,6 +126,7 @@ class _A11yAutocomplete { DOWN: 40, }); this.originalInput = input.cloneNode(); this.input = input; this.count = document.querySelectorAll('[data-autocomplete-input]').length; Loading Loading @@ -1209,7 +1210,7 @@ class _A11yAutocomplete { ); }); }); this.ul.remove(); this.wrapper.parentNode.replaceChild(this.originalInput, this.wrapper); /** * Fires after the instance is destroyed. Loading test/autocomplete.test.js +5 −5 Original line number Diff line number Diff line Loading @@ -190,17 +190,17 @@ describe('autocomplete', () => { it('option allowRepeatValues', async () => {}); // @todo fix the library :) it('api .destroy()', async () => { const originalHtml = `<div><input data-autocomplete></div>`; const originalInput = `<input data-autocomplete="">`; const childrenSelector = 'ul[data-autocomplete-item-list],span[data-autocomplete-live-region]'; const wrapper = await fixture(originalHtml); const auto = A11yAutocomplete(wrapper.firstChild); const wrapper = await fixture(`<div>${originalInput}</div>`); const input = wrapper.firstChild; const auto = A11yAutocomplete(input); expect(wrapper).dom.descendants(childrenSelector).and.have.length(2); auto.destroy(); //expect(wrapper).dom.to.have.html(originalHtml); expect(wrapper).dom.to.have.html(originalInput); }); it('api .id', async () => { Loading Loading
src/a11y.autocomplete.js +2 −1 Original line number Diff line number Diff line Loading @@ -126,6 +126,7 @@ class _A11yAutocomplete { DOWN: 40, }); this.originalInput = input.cloneNode(); this.input = input; this.count = document.querySelectorAll('[data-autocomplete-input]').length; Loading Loading @@ -1209,7 +1210,7 @@ class _A11yAutocomplete { ); }); }); this.ul.remove(); this.wrapper.parentNode.replaceChild(this.originalInput, this.wrapper); /** * Fires after the instance is destroyed. Loading
test/autocomplete.test.js +5 −5 Original line number Diff line number Diff line Loading @@ -190,17 +190,17 @@ describe('autocomplete', () => { it('option allowRepeatValues', async () => {}); // @todo fix the library :) it('api .destroy()', async () => { const originalHtml = `<div><input data-autocomplete></div>`; const originalInput = `<input data-autocomplete="">`; const childrenSelector = 'ul[data-autocomplete-item-list],span[data-autocomplete-live-region]'; const wrapper = await fixture(originalHtml); const auto = A11yAutocomplete(wrapper.firstChild); const wrapper = await fixture(`<div>${originalInput}</div>`); const input = wrapper.firstChild; const auto = A11yAutocomplete(input); expect(wrapper).dom.descendants(childrenSelector).and.have.length(2); auto.destroy(); //expect(wrapper).dom.to.have.html(originalHtml); expect(wrapper).dom.to.have.html(originalInput); }); it('api .id', async () => { Loading