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) {
|
||||
this.showDropdown();
|
||||
|
||||
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.
|
||||
*/
|
||||
if (this._isSelectOneElement) {
|
||||
this.input.value += keyString.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in a new issue