Disable at a later stage of intialising

This commit is contained in:
Josh Johnson 2018-10-30 22:04:08 +00:00
parent 2292b5282f
commit feb2a15edc
2 changed files with 10 additions and 8 deletions

View file

@ -8,5 +8,5 @@ install:
- npm install
script:
- npm run test:unit
- npm run test:e2e
- npm run coverage
- npm run test:e2e

View file

@ -178,6 +178,7 @@ class Choices {
this._createTemplates();
this._createElements();
this._createStructure();
// Set initial state (We need to clone the state because some reducers
// modify the inner objects properties in the state) 🤢
this._initialState = cloneObject(this._store.state);
@ -185,6 +186,14 @@ class Choices {
this._render();
this._addEventListeners();
const shouldDisable =
!this.config.addItems ||
this.passedElement.element.hasAttribute('disabled');
if (shouldDisable) {
this.disable();
}
this.initialised = true;
const { callbackOnInit } = this.config;
@ -1830,13 +1839,6 @@ class Choices {
this.input.setWidth(true);
}
if (
!this.config.addItems ||
this.passedElement.element.hasAttribute('disabled')
) {
this.disable();
}
this.containerOuter.element.appendChild(this.containerInner.element);
this.containerOuter.element.appendChild(this.dropdown.element);
this.containerInner.element.appendChild(this.itemList.element);