Update logic to affect both select inputs

This commit is contained in:
Josh Johnson 2019-11-19 21:25:07 +00:00
parent e2f5f59c7f
commit c6b8822199
2 changed files with 11 additions and 11 deletions

View file

@ -1344,12 +1344,12 @@ class Choices {
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericInput) {
this.showDropdown();
/*
We update the input value with the pressed key as
the input was not focussed at the time of key press
therefore does not have the value of the key.
*/
if (this._isSelectOneElement) {
if (!this.input.isFocussed) {
/*
We update the input value with the pressed key as
the input was not focussed at the time of key press
therefore does not have the value of the key.
*/
this.input.value += keyString.toLowerCase();
}
}

View file

@ -2094,7 +2094,7 @@ describe('choices', () => {
describe('select input', () => {
describe('when the dropdown is not active', () => {
describe('when the input was alpha-numeric', () => {
describe('when the key was alpha-numeric', () => {
beforeEach(() => {
instance._isTextElement = false;
instance.dropdown.isActive = false;
@ -2108,9 +2108,9 @@ describe('choices', () => {
expect(instance.showDropdown).to.have.been.calledWith();
});
describe('select-one input', () => {
describe('when the input is not focussed', () => {
beforeEach(() => {
instance._isSelectOneElement = true;
instance.input.isFocussed = false;
});
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(() => {
instance._isSelectOneElement = false;
instance.input.isFocussed = true;
});
it('does not update the input value', () => {