diff --git a/cypress/integration/select-multiple.spec.js b/cypress/integration/select-multiple.spec.js index 1402aec..5cf1f89 100644 --- a/cypress/integration/select-multiple.spec.js +++ b/cypress/integration/select-multiple.spec.js @@ -292,31 +292,10 @@ describe('Choices - select multiple', () => { }); describe('on click', () => { - it('opens choice dropdown', () => { + it('does not open choice dropdown', () => { cy.get('[data-test-hook=add-items-disabled]') .find('.choices__list--dropdown') - .should('be.visible'); - }); - }); - - describe('attempting to select choice', () => { - let selectedChoice; - - it('does not select choice', () => { - cy.get('[data-test-hook=add-items-disabled]') - .find('.choices__list--dropdown .choices__item') - .last() - .then($lastChoice => { - selectedChoice = $lastChoice; - }) - .click(); - - cy.get('[data-test-hook=add-items-disabled]') - .find('.choices__list--multiple .choices__item') - .last() - .should($item => { - expect($item.text()).to.not.contain(selectedChoice.text()); - }); + .should('not.be.visible'); }); }); }); @@ -335,31 +314,10 @@ describe('Choices - select multiple', () => { }); describe('on click', () => { - it('opens choice dropdown', () => { + it('does not opens choice dropdown', () => { cy.get('[data-test-hook=disabled-via-attr]') .find('.choices__list--dropdown') - .should('be.visible'); - }); - }); - - describe('attempting to select choice', () => { - let selectedChoice; - - it('does not select choice', () => { - cy.get('[data-test-hook=disabled-via-attr]') - .find('.choices__list--dropdown .choices__item') - .last() - .then($lastChoice => { - selectedChoice = $lastChoice; - }) - .click(); - - cy.get('[data-test-hook=disabled-via-attr]') - .find('.choices__list--multiple .choices__item') - .last() - .should($item => { - expect($item.text()).to.not.contain(selectedChoice.text()); - }); + .should('not.be.visible'); }); }); }); diff --git a/cypress/integration/select-one.spec.js b/cypress/integration/select-one.spec.js index c4b9f27..1fc7720 100644 --- a/cypress/integration/select-one.spec.js +++ b/cypress/integration/select-one.spec.js @@ -240,10 +240,10 @@ describe('Choices - select one', () => { }); describe('on click', () => { - it('opens choice dropdown', () => { + it('does not open choice dropdown', () => { cy.get('[data-test-hook=add-items-disabled]') .find('.choices__list--dropdown') - .should('be.visible'); + .should('not.be.visible'); }); }); diff --git a/src/scripts/choices.js b/src/scripts/choices.js index e2d16ae..e1ae4ca 100644 --- a/src/scripts/choices.js +++ b/src/scripts/choices.js @@ -1406,7 +1406,7 @@ class Choices { _onClick({ target }) { if (this.containerOuter.element.contains(target)) { - if (!this.dropdown.isActive) { + if (!this.dropdown.isActive && !this.containerOuter.isDisabled) { if (this._isTextElement) { if (document.activeElement !== this.input.element) { this.input.focus();