Skip to content

Commit 7d57d56

Browse files
Adding tests
1 parent f89e826 commit 7d57d56

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/unit/vuedraggable.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ describe("draggable.vue when initialized with list", () => {
9898
"modelValue and list props are mutually exclusive! Please set one or another."
9999
);
100100
});
101+
102+
it("renders an error when there is no item slot", () => {
103+
wrapper = mount(draggable, {
104+
props: {
105+
list: [],
106+
modelValue: [],
107+
itemKey: k => k
108+
}
109+
});
110+
111+
expect(wrapper.element.nodeName).toEqual("PRE");
112+
expect(wrapper.html()).toContain(
113+
"Error: draggable element must have an item slot"
114+
);
115+
})
101116
});
102117

103118
it("instantiate without error", () => {
@@ -146,6 +161,14 @@ describe("draggable.vue when initialized with list", () => {
146161
required: false,
147162
default: null
148163
}
164+
],
165+
[
166+
"itemKey",
167+
{
168+
type: [String, Function],
169+
required: true,
170+
default: undefined
171+
}
149172
]
150173
])("should have props %s equal to %j", (name, expectedValue) => {
151174
const { type, required, default: _default } = props[name];

0 commit comments

Comments
 (0)