-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathSelectionDialog.test.js
More file actions
43 lines (36 loc) · 1.5 KB
/
SelectionDialog.test.js
File metadata and controls
43 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { createLocalVue, mount } from "@vue/test-utils";
import { BTable } from "bootstrap-vue";
import { beforeEach, describe, expect, it } from "vitest";
import DataDialogSearch from "./DataDialogSearch.vue";
import SelectionDialog from "./SelectionDialog.vue";
const mockOptions = {
callback: () => {},
modalShow: true,
};
describe("SelectionDialog.vue", () => {
let wrapper;
let localVue;
beforeEach(() => {
localVue = createLocalVue();
wrapper = mount(SelectionDialog, {
propsData: mockOptions,
localVue,
});
});
it("loads correctly in loading state, shows options when optionsShow becomes true", async () => {
expect(wrapper.find("[data-description='selection dialog spinner']").exists()).toBeTruthy();
expect(wrapper.findComponent(BTable).exists()).toBeFalsy();
await wrapper.setProps({ optionsShow: true });
expect(wrapper.find("[data-description='selection dialog spinner']").exists()).toBeFalsy();
expect(wrapper.findComponent(BTable).exists()).toBeTruthy();
});
it("loads header correctly", async () => {
await localVue.nextTick();
expect(wrapper.findComponent(DataDialogSearch).exists()).toBeTruthy();
});
it("hideModal called on click cancel", async () => {
expect(wrapper.emitted().onCancel).toBeFalsy();
wrapper.find("[data-description='selection dialog cancel']").trigger("click");
expect(wrapper.emitted().onCancel).toBeTruthy();
});
});