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();
|
||||
});
|
||||
|
||||
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() {
|
||||
var input = $('<input />'),
|
||||
instance,
|
||||
|
@ -78,6 +78,7 @@
|
||||
triggerSelectOnValidInput: true,
|
||||
preventBadQueries: true,
|
||||
changeInputDisabled: false,
|
||||
hideOnSelectDisabled: false,
|
||||
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
|
||||
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
|
||||
},
|
||||
@ -697,7 +698,7 @@
|
||||
|
||||
select: function (i) {
|
||||
var that = this;
|
||||
that.hide();
|
||||
if (!that.options.hideOnSelectDisabled) { that.hide(); }
|
||||
that.onSelect(i);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user