2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-09 23:01:00 +00:00

Add dispose method test.

This commit is contained in:
Tomas Kirda 2013-04-24 14:46:04 -05:00
parent d3bdb0a61b
commit c650a51a15

View File

@ -355,4 +355,22 @@ describe('Autocomplete', function () {
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);
});
});