Skip to content

Commit 385e851

Browse files
Draggable - Add dispose safety test for missing scrollAnimator
1 parent 72043a2 commit 385e851

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import $ from '@js/core/renderer';
2+
import Sortable from '@js/ui/sortable';
3+
4+
describe('Draggable dispose safety', () => {
5+
beforeEach(() => {
6+
document.body.innerHTML = '';
7+
});
8+
9+
it('should not crash on _stopAnimator when _scrollAnimator is not initialized', () => {
10+
const $container = $('<div>').appendTo(document.body);
11+
const sortable = new Sortable($container, {});
12+
13+
(sortable as any)._scrollAnimator = undefined;
14+
15+
expect(() => {
16+
sortable.dispose();
17+
}).not.toThrow();
18+
});
19+
});

0 commit comments

Comments
 (0)