vue3-extended-multiselect 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Vue3ExtendedMultiselect.cjs.js +5295 -0
- package/dist/Vue3ExtendedMultiselect.cjs.js.map +1 -0
- package/dist/Vue3ExtendedMultiselect.esm.js +5290 -0
- package/dist/Vue3ExtendedMultiselect.esm.js.map +1 -0
- package/dist/types/index.d.ts +46 -0
- package/package.json +5 -1
- package/.browserslistrc +0 -3
- package/.eslintrc.js +0 -36
- package/.github/workflows/publish.yml +0 -41
- package/.nvmrc +0 -0
- package/CHANGELOG.md +0 -411
- package/CONTRIBUTING.md +0 -57
- package/babel.config.js +0 -10
- package/index.js +0 -3
- package/jest.config.js +0 -62
- package/rollup.config.mjs +0 -74
- package/src/components/ExtendedMultiselectCancel.vue +0 -165
- package/src/components/ExtendedMultiselectInput.vue +0 -742
- package/src/components/ExtendedMultiselectLoader.vue +0 -182
- package/src/components/ExtendedMultiselectMultiple.vue +0 -400
- package/src/components/ExtendedMultiselectOptions.vue +0 -1191
- package/src/components/ExtendedMultiselectToggle.vue +0 -272
- package/src/components/Vue3ExtendedMultiselect.vue +0 -2476
- package/src/composition/cancel.js +0 -40
- package/src/composition/click-outside.js +0 -9
- package/src/composition/debounce.js +0 -9
- package/src/composition/emitter.js +0 -9
- package/src/composition/image-path.js +0 -17
- package/src/composition/labels.js +0 -42
- package/src/composition/preselected-options.js +0 -68
- package/src/composition/search-value.js +0 -34
- package/src/composition/sizes.js +0 -45
- package/src/composition/toggle.js +0 -32
- package/src/sets/sets.js +0 -100
- package/src/styles/animations.css +0 -19
- package/src/styles/main.css +0 -460
- package/src/styles/variables.css +0 -52
- package/src/tools/Debounce.js +0 -26
- package/src/tools/LocalEmitter.js +0 -32
- package/src/tools/instance.js +0 -3
- package/tests/unit/events.spec.js +0 -150
- package/tests/unit/props.spec.js +0 -1155
- package/tests/unit/tools.spec.js +0 -56
- package/tests/utils/mocks.js +0 -1
- package/tests/utils/mount.js +0 -38
- package/tests/utils/stubs.js +0 -1
- package/tests/utils/utils.js +0 -25
- package/typings/vue3-extended-multiselect.d.ts +0 -44
- /package/{src → dist}/assets/images/base-arrow.svg +0 -0
- /package/{src → dist}/assets/images/cancel.svg +0 -0
- /package/{src → dist}/assets/images/circle-arrow.svg +0 -0
- /package/{src → dist}/assets/images/double-arrow.svg +0 -0
- /package/{src → dist}/assets/images/inner-arrow.svg +0 -0
- /package/{src → dist}/assets/images/loader.svg +0 -0
- /package/{src → dist}/assets/images/triangle-arrow.svg +0 -0
- /package/{src → dist}/assets/images/triangle-circle-arrow.svg +0 -0
- /package/{src → dist}/assets/images/wide-arrow.svg +0 -0
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { fireEvent } from "@testing-library/dom";
|
|
2
|
-
import {
|
|
3
|
-
mountComponent,
|
|
4
|
-
wrapperProvides,
|
|
5
|
-
SEARCH_PATTERN,
|
|
6
|
-
} from "../utils/mount";
|
|
7
|
-
import {
|
|
8
|
-
mockOptionSelection,
|
|
9
|
-
mockOptionsLoader,
|
|
10
|
-
createNewOptionsWrapper,
|
|
11
|
-
} from "../utils/utils";
|
|
12
|
-
|
|
13
|
-
import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
|
|
14
|
-
import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
|
|
15
|
-
import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
|
|
16
|
-
|
|
17
|
-
let wrapper;
|
|
18
|
-
|
|
19
|
-
describe("events", () => {
|
|
20
|
-
it("correctly emits 'pattern-changed' event", async () => {
|
|
21
|
-
const propsData = {
|
|
22
|
-
options: globalThis.OPTIONS,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
|
|
26
|
-
|
|
27
|
-
wrapper.vm.emitter.emit(
|
|
28
|
-
"extended:search-pattern-changed",
|
|
29
|
-
globalThis.SEARCH_VALUE,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
|
|
33
|
-
|
|
34
|
-
propsData.options = mockOptionsLoader;
|
|
35
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
|
|
36
|
-
|
|
37
|
-
wrapper.vm.emitter.emit(
|
|
38
|
-
"extended:loader-pattern-changed",
|
|
39
|
-
globalThis.SEARCH_VALUE_WITH_RESULTS,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE_WITH_RESULTS);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
it("correctly emits 'select' event", async () => {
|
|
47
|
-
const propsData = {
|
|
48
|
-
defaultExpanded: true,
|
|
49
|
-
simpleEvents: false,
|
|
50
|
-
inputId: globalThis.INPUT_ID,
|
|
51
|
-
options: globalThis.OPTIONS,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
55
|
-
|
|
56
|
-
await mockOptionSelection(wrapper);
|
|
57
|
-
|
|
58
|
-
expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
|
|
59
|
-
expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
it("correctly emits 'clean' event", async () => {
|
|
64
|
-
const propsData = {
|
|
65
|
-
showClearIcon: true,
|
|
66
|
-
defaultExpanded: true,
|
|
67
|
-
options: globalThis.OPTIONS,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
71
|
-
|
|
72
|
-
const cleanButton = wrapper.find("#extended__multiselect-cancel");
|
|
73
|
-
|
|
74
|
-
await mockOptionSelection(wrapper);
|
|
75
|
-
|
|
76
|
-
await fireEvent.click(cleanButton.element);
|
|
77
|
-
|
|
78
|
-
expect(wrapper.emitted().clean).toBeDefined();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
it("correctly emits 'option-created' event", async () => {
|
|
83
|
-
const propsData = {
|
|
84
|
-
defaultExpanded: true,
|
|
85
|
-
createOnTheGo: true,
|
|
86
|
-
inputId: globalThis.INPUT_ID,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
wrapper = await mountComponent(
|
|
90
|
-
Vue3ExtendedMultiselect,
|
|
91
|
-
false,
|
|
92
|
-
propsData,
|
|
93
|
-
wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
|
|
97
|
-
|
|
98
|
-
expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
it("correctly emits 'active' event", async () => {
|
|
103
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
|
|
104
|
-
|
|
105
|
-
const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
|
|
106
|
-
const field = inputWrapper.find("input");
|
|
107
|
-
|
|
108
|
-
await fireEvent.focus(field.element);
|
|
109
|
-
|
|
110
|
-
expect(wrapper.emitted().active[0][0]).toBeNull();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
it("correctly emits 'close' event", async () => {
|
|
115
|
-
const propsData = {
|
|
116
|
-
defaultExpanded: true,
|
|
117
|
-
simpleEvents: false,
|
|
118
|
-
inputId: globalThis.INPUT_ID,
|
|
119
|
-
options: globalThis.OPTIONS,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
123
|
-
|
|
124
|
-
await mockOptionSelection(wrapper);
|
|
125
|
-
|
|
126
|
-
expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
|
|
127
|
-
expect(wrapper.emitted().close[0][0].options).toHaveLength(1);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
it("correctly emits 'increase' event", async () => {
|
|
132
|
-
expect.assertions(1);
|
|
133
|
-
|
|
134
|
-
const propsData = {
|
|
135
|
-
multiple: true,
|
|
136
|
-
toggleMultipleBlocksLimit: true,
|
|
137
|
-
multipleBlocksLimit: 1,
|
|
138
|
-
increaseDisplayBy: 1,
|
|
139
|
-
preselectedOptions: globalThis.OPTIONS,
|
|
140
|
-
options: globalThis.OPTIONS,
|
|
141
|
-
};
|
|
142
|
-
const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
143
|
-
const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
|
|
144
|
-
const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
|
|
145
|
-
|
|
146
|
-
await fireEvent.click(increaserWrapper.element);
|
|
147
|
-
|
|
148
|
-
expect(wrapper.emitted().increase[0][0]).toEqual(2);
|
|
149
|
-
});
|
|
150
|
-
});
|