mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-25 14:17:45 +00:00
added test case for onHide callback
This commit is contained in:
parent
5d5513f0f2
commit
fdae40056f
@ -677,4 +677,30 @@ describe('Autocomplete', function () {
|
||||
expect(suggestionsContainer.find('.autocomplete-no-suggestion').text()).toBe('Sorry, no matching results')
|
||||
});
|
||||
|
||||
it('Should call onHide and pass container jQuery object', function () {
|
||||
var element = document.createElement('input'),
|
||||
input = $(element),
|
||||
instance,
|
||||
elementCount,
|
||||
context;
|
||||
|
||||
input.autocomplete({
|
||||
lookup: [{ value: 'Jamaica', data: 'B' }],
|
||||
onHide: function (container) {
|
||||
context = this;
|
||||
elementCount = container.length;
|
||||
}
|
||||
});
|
||||
|
||||
input.val('Jam');
|
||||
instance = input.autocomplete();
|
||||
instance.onValueChange();
|
||||
|
||||
input.val('Colombia');
|
||||
instance.onValueChange();
|
||||
|
||||
expect(context).toBe(element);
|
||||
expect(elementCount).toBe(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user