mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-25 22:27:39 +00:00
Added hideOnSelectDisabled option to prevent suggestion box to hide when select. Very useful when using changeInputDisabled is true.
This commit is contained in:
parent
d110e29cf4
commit
e5c457b694
@ -543,6 +543,27 @@ describe('Autocomplete', function () {
|
|||||||
expect(suggestionData).toBeNull();
|
expect(suggestionData).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should NOT hide suggestions when options.hideOnSelectDisabled is true and item is selected', function() {
|
||||||
|
$('.autocomplete-suggestions').remove();
|
||||||
|
|
||||||
|
var input = $('<input />'),
|
||||||
|
instance,
|
||||||
|
suggestionData = null;
|
||||||
|
|
||||||
|
input.autocomplete({
|
||||||
|
lookup: [{ value: 'Jamaica', data: 'J' }],
|
||||||
|
hideOnSelectDisabled: true
|
||||||
|
});
|
||||||
|
|
||||||
|
input.val('J');
|
||||||
|
instance = input.autocomplete();
|
||||||
|
|
||||||
|
instance.onValueChange();
|
||||||
|
instance.select(0);
|
||||||
|
|
||||||
|
expect($('.autocomplete-suggestions').is(':visible')).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
describe('options.changeInputDisabled is true', function() {
|
describe('options.changeInputDisabled is true', function() {
|
||||||
var input = $('<input />'),
|
var input = $('<input />'),
|
||||||
instance,
|
instance,
|
||||||
|
@ -78,6 +78,7 @@
|
|||||||
triggerSelectOnValidInput: true,
|
triggerSelectOnValidInput: true,
|
||||||
preventBadQueries: true,
|
preventBadQueries: true,
|
||||||
changeInputDisabled: false,
|
changeInputDisabled: false,
|
||||||
|
hideOnSelectDisabled: false,
|
||||||
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
|
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
|
||||||
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
|
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
|
||||||
},
|
},
|
||||||
@ -697,7 +698,7 @@
|
|||||||
|
|
||||||
select: function (i) {
|
select: function (i) {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.hide();
|
if (!that.options.hideOnSelectDisabled) { that.hide(); }
|
||||||
that.onSelect(i);
|
that.onSelect(i);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user