Skip to content

Commit 8a089d6

Browse files
Adding tests
1 parent 2bb8895 commit 8a089d6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unit/vuedraggable.spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,16 @@ describe("draggable.vue when initialized with list", () => {
595595
expect(SortableFake.option).toHaveBeenCalledWith(sortableAttribute, value);
596596
}
597597
);
598+
599+
test.each(["Start", "Add", "Remove", "Update", "End", "Choose", "Sort", "Filter", "Clone", "Move"])
600+
("do not call option when updating option on%s",
601+
(callBack) =>{
602+
vm.$attrs = { [`on${callBack}`]: jest.fn() };
603+
expect(SortableFake.option).not.toHaveBeenCalled();
604+
});
605+
606+
607+
598608
});
599609

600610
test.each([
@@ -617,6 +627,11 @@ describe("draggable.vue when initialized with list", () => {
617627
expect(SortableFake.destroy).toHaveBeenCalled();
618628
expect(SortableFake.destroy.mock.calls.length).toBe(1);
619629
});
630+
631+
it("does not throw when sortable is not set", () => {
632+
delete vm._sortable;
633+
expect(() =>wrapper.destroy()).not.toThrow();
634+
});
620635
})
621636

622637
describe("draggable.vue when initialized with value", () => {

0 commit comments

Comments
 (0)