mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-23 16:02:21 +02:00
Update logic to affect both select inputs
This commit is contained in:
parent
e2f5f59c7f
commit
c6b8822199
|
@ -1344,12 +1344,12 @@ class Choices {
|
||||||
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericInput) {
|
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericInput) {
|
||||||
this.showDropdown();
|
this.showDropdown();
|
||||||
|
|
||||||
|
if (!this.input.isFocussed) {
|
||||||
/*
|
/*
|
||||||
We update the input value with the pressed key as
|
We update the input value with the pressed key as
|
||||||
the input was not focussed at the time of key press
|
the input was not focussed at the time of key press
|
||||||
therefore does not have the value of the key.
|
therefore does not have the value of the key.
|
||||||
*/
|
*/
|
||||||
if (this._isSelectOneElement) {
|
|
||||||
this.input.value += keyString.toLowerCase();
|
this.input.value += keyString.toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2094,7 +2094,7 @@ describe('choices', () => {
|
||||||
|
|
||||||
describe('select input', () => {
|
describe('select input', () => {
|
||||||
describe('when the dropdown is not active', () => {
|
describe('when the dropdown is not active', () => {
|
||||||
describe('when the input was alpha-numeric', () => {
|
describe('when the key was alpha-numeric', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
instance._isTextElement = false;
|
instance._isTextElement = false;
|
||||||
instance.dropdown.isActive = false;
|
instance.dropdown.isActive = false;
|
||||||
|
@ -2108,9 +2108,9 @@ describe('choices', () => {
|
||||||
expect(instance.showDropdown).to.have.been.calledWith();
|
expect(instance.showDropdown).to.have.been.calledWith();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('select-one input', () => {
|
describe('when the input is not focussed', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
instance._isSelectOneElement = true;
|
instance.input.isFocussed = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('updates the input value with the character corresponding to the key code', () => {
|
it('updates the input value with the character corresponding to the key code', () => {
|
||||||
|
@ -2122,9 +2122,9 @@ describe('choices', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('select-multiple input', () => {
|
describe('when the input is focussed', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
instance._isSelectOneElement = false;
|
instance.input.isFocussed = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not update the input value', () => {
|
it('does not update the input value', () => {
|
||||||
|
|
Loading…
Reference in a new issue