mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-12-23 11:28:53 +00:00
Add dispose method test.
This commit is contained in:
parent
d3bdb0a61b
commit
c650a51a15
@ -355,4 +355,22 @@ describe('Autocomplete', function () {
|
|||||||
expect(paramValue).toBe('Jam');
|
expect(paramValue).toBe('Jam');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should destroy autocomplete instance', function () {
|
||||||
|
var input = $(document.createElement('input')),
|
||||||
|
div = $(document.createElement('div'));
|
||||||
|
|
||||||
|
input.autocomplete({
|
||||||
|
serviceUrl: '/test-dispose',
|
||||||
|
appendTo: div
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(input.data('autocomplete')).toBeDefined();
|
||||||
|
expect(div.children().length).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
input.autocomplete('dispose');
|
||||||
|
|
||||||
|
expect(input.data('autocomplete')).toBeUndefined();
|
||||||
|
expect(div.children().length).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user