Skip to content

Commit c650a51

Browse files
author
Tomas Kirda
committed
Add dispose method test.
1 parent d3bdb0a commit c650a51

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/autocompleteBehavior.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,22 @@ describe('Autocomplete', function () {
355355
expect(paramValue).toBe('Jam');
356356
});
357357
});
358+
359+
it('Should destroy autocomplete instance', function () {
360+
var input = $(document.createElement('input')),
361+
div = $(document.createElement('div'));
362+
363+
input.autocomplete({
364+
serviceUrl: '/test-dispose',
365+
appendTo: div
366+
});
367+
368+
expect(input.data('autocomplete')).toBeDefined();
369+
expect(div.children().length).toBeGreaterThan(0);
370+
371+
input.autocomplete('dispose');
372+
373+
expect(input.data('autocomplete')).toBeUndefined();
374+
expect(div.children().length).toBe(0);
375+
});
358376
});

0 commit comments

Comments
 (0)