Skip to content

Commit 8ddf9e0

Browse files
Improving tests
1 parent 8a0ace2 commit 8ddf9e0

File tree

3 files changed

+59
-14
lines changed

3 files changed

+59
-14
lines changed

tests/unit/draggable.spec.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/unit/vuedraggable.spec.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { shallowMount } from "@vue/test-utils";
2+
import draggable from "@/vuedraggable";
3+
4+
let wrapper;
5+
let vm;
6+
let props;
7+
8+
describe("draggable.vue", () => {
9+
beforeEach(() => {
10+
wrapper = shallowMount(draggable);
11+
vm = wrapper.vm;
12+
props = vm.$options.props;
13+
});
14+
15+
it("should instanciate without error", () => {
16+
expect(wrapper).not.toBeUndefined();
17+
});
18+
19+
test.each([
20+
["options", { type: Object }],
21+
["list", {
22+
type: Array,
23+
required: false,
24+
default: null
25+
}],
26+
["value", {
27+
type: Array,
28+
required: false,
29+
default: null
30+
}],
31+
["noTransitionOnDrag", {
32+
type: Boolean,
33+
default: false
34+
}],
35+
["element", {
36+
type: String,
37+
default: "div"
38+
}],
39+
["tag", {
40+
type: String,
41+
default: null
42+
}],
43+
["move", {
44+
type: Function,
45+
default: null
46+
}],
47+
["componentData", {
48+
type: Object,
49+
required: false,
50+
default: null
51+
}]
52+
])(
53+
"should have props %s equal to %o",
54+
(name, value) => {
55+
const propsValue = props[name];
56+
expect(propsValue).toEqual(value);
57+
}
58+
)
59+
});

0 commit comments

Comments
 (0)