@webitel/ui-sdk 24.10.3 → 24.10.4
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/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +111 -114
- package/dist/ui-sdk.umd.cjs +8 -8
- package/package.json +6 -4
- package/src/api/axios/generateInstance.js +1 -4
- package/src/api/clients/agents/agents.js +31 -78
- package/src/api/clients/buckets/buckets.js +17 -57
- package/src/api/clients/calendars/calendars.js +18 -71
- package/src/api/clients/chatGateways/chatGateways.js +23 -61
- package/src/api/clients/chatGateways/defaults/webChatGateway.js +6 -8
- package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.js +3 -3
- package/src/api/clients/communications/communications.js +20 -62
- package/src/api/clients/configurations/configurations.js +18 -3
- package/src/api/clients/flows/flow.js +17 -60
- package/src/api/clients/gateways/gateways.js +20 -59
- package/src/api/clients/index.js +1 -1
- package/src/api/clients/lists/blacklists.js +18 -60
- package/src/api/clients/media/media.js +13 -43
- package/src/api/clients/queues/defaults/processing.js +10 -6
- package/src/api/clients/queues/queues.js +21 -69
- package/src/api/clients/roles/roles.js +15 -33
- package/src/api/clients/users/__tests__/users.spec.js +43 -26
- package/src/api/clients/users/users.js +21 -56
- package/src/api/crm/contactChatMessagesHistory.js +8 -23
- package/src/api/crm/index.js +1 -3
- package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +1 -4
- package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +10 -11
- package/src/api/defaults/getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js +6 -5
- package/src/api/defaults/index.js +2 -4
- package/src/api/history/index.js +1 -3
- package/src/api/history/transcript/callTranscript.js +10 -30
- package/src/api/interceptors/request/updateToken.interceptor.js +1 -2
- package/src/api/transformers/merge/merge.transformer.js +4 -1
- package/src/api/transformers/mergeEach/mergeEach.transformer.js +4 -4
- package/src/api/transformers/notify/notify.transformer.js +9 -6
- package/src/api/transformers/starToSearch/starToSearch.transformer.js +8 -6
- package/src/components/index.js +3 -6
- package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +2 -4
- package/src/components/transitions/wt-expand-transition.vue +2 -3
- package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +1 -2
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +1 -2
- package/src/components/wt-app-header/wt-app-navigator.vue +15 -9
- package/src/components/wt-avatar/wt-avatar.vue +8 -3
- package/src/components/wt-button/wt-button.vue +0 -1
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +4 -5
- package/src/components/wt-button-select/wt-button-select.vue +0 -1
- package/src/components/wt-context-menu/wt-context-menu.vue +32 -35
- package/src/components/wt-dummy/wt-dummy.vue +2 -5
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +10 -7
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +4 -8
- package/src/components/wt-icon/wt-icon.vue +0 -1
- package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +3 -2
- package/src/components/wt-indicator/wt-indicator.vue +10 -1
- package/src/components/wt-input/wt-input.vue +7 -10
- package/src/components/wt-item-link/wt-item-link.vue +7 -4
- package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +7 -15
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +7 -7
- package/src/components/wt-notification/wt-notification.vue +1 -2
- package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +6 -3
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -1
- package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +1 -2
- package/src/components/wt-pagination/wt-pagination.vue +1 -3
- package/src/components/wt-player/scripts/__tests__/createPlyrURL.spec.js +4 -8
- package/src/components/wt-player/wt-player.vue +13 -4
- package/src/components/wt-popup/wt-popup.vue +2 -1
- package/src/components/wt-search-bar/wt-search-bar.vue +1 -1
- package/src/components/wt-select/mixins/multiselectMixin.js +2 -5
- package/src/components/wt-select/wt-select.vue +12 -11
- package/src/components/wt-slider/wt-slider.vue +4 -2
- package/src/components/wt-status-select/wt-status-select.vue +10 -6
- package/src/components/wt-stepper/wt-stepper.vue +6 -4
- package/src/components/wt-switcher/wt-switcher.vue +1 -3
- package/src/components/wt-table/__tests__/WtTable.spec.js +2 -5
- package/src/components/wt-table/wt-table.vue +18 -16
- package/src/components/wt-table-column-select/wt-table-column-select.vue +9 -8
- package/src/components/wt-tabs/wt-tabs.vue +1 -3
- package/src/components/wt-tags-input/mixin/taggableMixin.js +7 -7
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +2 -4
- package/src/components/wt-textarea/wt-textarea.vue +3 -2
- package/src/components/wt-timepicker/wt-timepicker.vue +1 -3
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +1 -3
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +8 -12
- package/src/components/wt-tooltip/wt-tooltip.vue +13 -13
- package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +6 -4
- package/src/composables/useCachedInterval/useCachedInterval.js +3 -8
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +11 -33
- package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +11 -9
- package/src/enums/WebitelApplications/AdminSections.enum.js +28 -28
- package/src/enums/WebitelApplications/CrmSections.enum.js +1 -1
- package/src/locale/en/en.js +12 -15
- package/src/locale/es/es.js +4 -8
- package/src/locale/kz/kz.js +5 -7
- package/src/locale/ru/ru.js +7 -11
- package/src/locale/ua/ua.js +13 -17
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +1 -2
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +4 -2
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +4 -1
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +5 -6
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +1 -4
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +1 -2
- package/src/mixins/validationMixin/useValidation.js +25 -19
- package/src/mixins/validationMixin/validationMixin.js +22 -10
- package/src/modules/AgentStatusSelect/api/pause-cause.js +3 -11
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +16 -18
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +1 -2
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +12 -12
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +0 -1
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +20 -7
- package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +2 -4
- package/src/modules/Appearance/components/wt-dark-mode-switcher.vue +0 -1
- package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +1 -2
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +15 -25
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +11 -20
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +1 -4
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +4 -7
- package/src/modules/AuditForm/components/audit-form-question.vue +18 -17
- package/src/modules/AuditForm/components/audit-form.vue +12 -14
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +1 -2
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +1 -3
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +11 -15
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +1 -4
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +16 -20
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +1 -3
- package/src/modules/CSVExport/CSVExport.js +3 -7
- package/src/modules/CSVExport/XLSExport.js +6 -7
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +1 -2
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +2 -5
- package/src/modules/CSVExport/mixins/exportXLSMixin.js +2 -4
- package/src/modules/CardStoreModule/store/CardStoreModule.js +2 -6
- package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +13 -10
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +5 -14
- package/src/modules/FilesExport/FilesExport.js +4 -3
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +12 -12
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -7
- package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -2
- package/src/modules/Filters/classes/BaseFilterSchema.js +21 -25
- package/src/modules/Filters/components/filter-pagination.vue +7 -3
- package/src/modules/Filters/components/filter-search.vue +21 -12
- package/src/modules/Filters/components/filter-table-fields.vue +1 -3
- package/src/modules/Filters/scripts/getters/index.js +1 -5
- package/src/modules/Filters/scripts/getters/queryGetter.js +2 -3
- package/src/modules/Filters/scripts/restores/index.js +1 -4
- package/src/modules/Filters/scripts/setters/index.js +1 -5
- package/src/modules/Filters/scripts/setters/querySetter.js +24 -22
- package/src/modules/Filters/scripts/utils/changeRouteQuery.js +16 -15
- package/src/modules/Filters/store/FiltersStoreModule.js +51 -45
- package/src/modules/Filters/store/__tests__/FiltersStoreModule.spec.js +51 -45
- package/src/modules/Notifications/store/NotificationsStoreModule.js +41 -38
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
- package/src/modules/QueryFilters/api/defaults.js +2 -3
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +1 -4
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +1 -4
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +1 -2
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +2 -4
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -4
- package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -5
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +4 -3
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -4
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +4 -2
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +4 -1
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +1 -1
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +4 -2
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +9 -11
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +2 -4
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -5
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +13 -17
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +15 -16
- package/src/modules/TableStoreModule/store/TableStoreModule.js +14 -33
- package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +69 -83
- package/src/modules/Userinfo/api/userinfo.js +6 -19
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +5 -12
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +38 -41
- package/src/plugins/breakpoint/breakpoint.plugin.js +11 -16
- package/src/scripts/__tests__/caseConverters.spec.js +1 -4
- package/src/scripts/__tests__/debounce.spec.js +3 -1
- package/src/scripts/__tests__/prettifyFileSize.spec.js +2 -2
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +7 -4
- package/src/scripts/__tests__/updateObject.spec.js +3 -5
- package/src/scripts/caseConverters.js +22 -38
- package/src/scripts/debounce.js +1 -5
- package/src/scripts/editProxy.js +8 -7
- package/src/scripts/prettifyFileSize.js +1 -1
- package/src/scripts/preventHiddenPageCallsDecorator.js +3 -6
- package/src/store/BaseStoreModules/ApiStoreModule.js +7 -33
- package/src/store/BaseStoreModules/BaseStoreModule.js +14 -23
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +7 -28
- package/src/store/helpers/getNamespacedState.js +2 -4
- package/src/store/new/modules/apiStoreModule/apiStoreModule.js +7 -27
- package/src/store/new/modules/cardStoreModule/cardStoreModule.js +0 -1
- package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +64 -77
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +12 -29
- package/src/tests/mocks/axiosMock.js +25 -19
- package/src/validators/decimalValidator.js +5 -4
- package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +1 -2
- package/src/validators/websocketValidator/websocketValidator.js +1 -1
|
@@ -13,7 +13,8 @@ const headers = [
|
|
|
13
13
|
show: true,
|
|
14
14
|
sort: null,
|
|
15
15
|
field: 'queue',
|
|
16
|
-
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
17
18
|
value: 'agents',
|
|
18
19
|
show: true,
|
|
19
20
|
sort: null,
|
|
@@ -27,7 +28,8 @@ const sortedHeaders = [
|
|
|
27
28
|
show: true,
|
|
28
29
|
sort: 'asc',
|
|
29
30
|
field: 'queue',
|
|
30
|
-
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
31
33
|
value: 'agents',
|
|
32
34
|
show: true,
|
|
33
35
|
sort: null,
|
|
@@ -26,7 +26,10 @@ describe('URL Controller mixin Set and Get operations', () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it('Array of objects', async () => {
|
|
29
|
-
const value = [
|
|
29
|
+
const value = [
|
|
30
|
+
{ name: 'team 1', id: '1' },
|
|
31
|
+
{ name: 'team 2', id: '2' },
|
|
32
|
+
];
|
|
30
33
|
await wrapper.vm.setValueToQuery({ filterQuery, value });
|
|
31
34
|
const queryValue = wrapper.vm.getValueFromQuery({ filterQuery });
|
|
32
35
|
expect(queryValue).toEqual(['1', '2']);
|
|
@@ -12,8 +12,7 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
methods: {
|
|
14
14
|
async restoreValue(idList) {
|
|
15
|
-
this.value = idList
|
|
16
|
-
? await this.fetchSelected(idList) : this.defaultValue;
|
|
15
|
+
this.value = idList?.length ? await this.fetchSelected(idList) : this.defaultValue;
|
|
17
16
|
},
|
|
18
17
|
|
|
19
18
|
async fetchSelected(idList) {
|
|
@@ -22,8 +22,7 @@ export default {
|
|
|
22
22
|
|
|
23
23
|
methods: {
|
|
24
24
|
restore({ filterQuery }) {
|
|
25
|
-
const value = this.getValueFromQuery({ filterQuery }) ||
|
|
26
|
-
this.defaultValue;
|
|
25
|
+
const value = this.getValueFromQuery({ filterQuery }) || this.defaultValue;
|
|
27
26
|
this.restoreValue(value);
|
|
28
27
|
},
|
|
29
28
|
},
|
|
@@ -19,13 +19,12 @@ export default {
|
|
|
19
19
|
methods: {
|
|
20
20
|
restoreValue(value) {
|
|
21
21
|
if (Array.isArray(value)) {
|
|
22
|
-
this.value = this.options
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
this.value = this.options.filter((option) =>
|
|
23
|
+
value.some((value) => `${value}` === option[this.storedProp]),
|
|
24
|
+
);
|
|
25
25
|
} else {
|
|
26
|
-
this.value =
|
|
27
|
-
.find((option) => option[this.storedProp] === value) ||
|
|
28
|
-
this.defaultValue;
|
|
26
|
+
this.value =
|
|
27
|
+
this.options.find((option) => option[this.storedProp] === value) || this.defaultValue;
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
30
|
},
|
|
@@ -18,8 +18,7 @@ export default {
|
|
|
18
18
|
watch: {
|
|
19
19
|
'$route.query': {
|
|
20
20
|
handler(newValue, oldValue) {
|
|
21
|
-
if (newValue.page !== oldValue.page
|
|
22
|
-
|| newValue.size !== oldValue.size) {
|
|
21
|
+
if (newValue.page !== oldValue.page || newValue.size !== oldValue.size) {
|
|
23
22
|
this.restore();
|
|
24
23
|
}
|
|
25
24
|
},
|
|
@@ -41,10 +41,7 @@ const queryToSortAdapter = (order) => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const encodeSortQuery = ({
|
|
45
|
-
column,
|
|
46
|
-
order,
|
|
47
|
-
}) => (`${sortToQueryAdapter(order)}${column.field}`);
|
|
44
|
+
const encodeSortQuery = ({ column, order }) => `${sortToQueryAdapter(order)}${column.field}`;
|
|
48
45
|
|
|
49
46
|
const decodeSortQuery = ({ value }) => {
|
|
50
47
|
const sort = queryToSortAdapter(value.slice(0, 1));
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { computed, isReactive } from 'vue';
|
|
2
2
|
import { useI18n } from 'vue-i18n';
|
|
3
3
|
|
|
4
|
-
export function useValidation({
|
|
5
|
-
v: inputV,
|
|
6
|
-
customValidators: inputCustomValidators,
|
|
7
|
-
}) {
|
|
4
|
+
export function useValidation({ v: inputV, customValidators: inputCustomValidators }) {
|
|
8
5
|
const { t } = useI18n();
|
|
9
6
|
|
|
10
7
|
// support vue options api, where v is a reactive, not ref
|
|
@@ -17,8 +14,7 @@ export function useValidation({
|
|
|
17
14
|
}
|
|
18
15
|
// end
|
|
19
16
|
|
|
20
|
-
const isValidation = computed(() => !!v && !!v.value &&
|
|
21
|
-
!!Object.keys(v.value).length);
|
|
17
|
+
const isValidation = computed(() => !!v && !!v.value && !!Object.keys(v.value).length);
|
|
22
18
|
const invalid = computed(() => isValidation.value && v.value.$error);
|
|
23
19
|
|
|
24
20
|
const validationText = computed(() => {
|
|
@@ -27,26 +23,36 @@ export function useValidation({
|
|
|
27
23
|
if (v.value.required?.$invalid) validationText = t('validation.required');
|
|
28
24
|
else if (v.value.numeric?.$invalid) validationText = t('validation.numeric');
|
|
29
25
|
else if (v.value.email?.$invalid) validationText = t('validation.email');
|
|
30
|
-
else if (v.value.gatewayHostValidator?.$invalid)
|
|
26
|
+
else if (v.value.gatewayHostValidator?.$invalid)
|
|
27
|
+
validationText = t('validation.gatewayHostValidator');
|
|
31
28
|
else if (v.value.ipValidator?.$invalid) validationText = t('validation.ipValidator');
|
|
32
29
|
else if (v.value.macValidator?.$invalid) validationText = t('validation.macValidator');
|
|
33
|
-
else if (v.value.minValue?.$invalid)
|
|
34
|
-
|
|
35
|
-
else if (v.value.
|
|
36
|
-
|
|
30
|
+
else if (v.value.minValue?.$invalid)
|
|
31
|
+
validationText = `${t('validation.minValue')} ${v.value.minValue.$params.min}`;
|
|
32
|
+
else if (v.value.maxValue?.$invalid)
|
|
33
|
+
validationText = `${t('validation.maxValue')} ${v.value.maxValue.$params.max}`;
|
|
34
|
+
else if (v.value.sipAccountValidator?.$invalid)
|
|
35
|
+
validationText = t('validation.sipAccountValidator');
|
|
36
|
+
else if (v.value.minLength?.$invalid)
|
|
37
|
+
validationText = `${t('validation.minLength')} ${v.value.minLength.$params.min}`;
|
|
37
38
|
else if (v.value.url?.$invalid) validationText = `${t('validation.url')}`;
|
|
38
|
-
else if (v.value.regExpValidator?.$invalid)
|
|
39
|
+
else if (v.value.regExpValidator?.$invalid)
|
|
40
|
+
validationText = `${t('validation.regExpValidator')}`;
|
|
39
41
|
else if (v.value.sameAs?.$invalid) validationText = `${t('validation.sameAs')}`;
|
|
40
|
-
else if (v.value.domainValidator?.$invalid)
|
|
41
|
-
|
|
42
|
-
else if (v.value.
|
|
42
|
+
else if (v.value.domainValidator?.$invalid)
|
|
43
|
+
validationText = `${t('validation.domainValidator')}`;
|
|
44
|
+
else if (v.value.decimalValidator?.$invalid)
|
|
45
|
+
validationText = `${t('validation.decimalValidator')} ${v.value.decimalValidator.$params.count}`;
|
|
46
|
+
else if (v.value.websocketValidator?.$invalid)
|
|
47
|
+
validationText = `${t('validation.websocketValidator')}`;
|
|
43
48
|
else if (v.value.integer?.$invalid) validationText = `${t('validation.integer')}`;
|
|
44
|
-
else if (v.value.regex?.$invalid)
|
|
45
|
-
|
|
49
|
+
else if (v.value.regex?.$invalid)
|
|
50
|
+
validationText =
|
|
51
|
+
v.value.regex?.$message ||
|
|
52
|
+
`${t('validation.isRegExpMatched')} ${v.value.regex?.$params?.regex}`;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
if (customValidators
|
|
49
|
-
|
|
55
|
+
if (customValidators?.value) {
|
|
50
56
|
for (const { name, text } of customValidators.value) {
|
|
51
57
|
if (v.value[name]?.$invalid) validationText = text;
|
|
52
58
|
}
|
|
@@ -22,21 +22,33 @@ export default {
|
|
|
22
22
|
if (this.v.required?.$invalid) validationText = this.$t('validation.required');
|
|
23
23
|
else if (this.v.numeric?.$invalid) validationText = this.$t('validation.numeric');
|
|
24
24
|
else if (this.v.email?.$invalid) validationText = this.$t('validation.email');
|
|
25
|
-
else if (this.v.gatewayHostValidator?.$invalid)
|
|
25
|
+
else if (this.v.gatewayHostValidator?.$invalid)
|
|
26
|
+
validationText = this.$t('validation.gatewayHostValidator');
|
|
26
27
|
else if (this.v.ipValidator?.$invalid) validationText = this.$t('validation.ipValidator');
|
|
27
28
|
else if (this.v.macValidator?.$invalid) validationText = this.$t('validation.macValidator');
|
|
28
|
-
else if (this.v.minValue?.$invalid)
|
|
29
|
-
|
|
30
|
-
else if (this.v.
|
|
31
|
-
|
|
29
|
+
else if (this.v.minValue?.$invalid)
|
|
30
|
+
validationText = `${this.$t('validation.minValue')} ${this.v.minValue.$params.min}`;
|
|
31
|
+
else if (this.v.maxValue?.$invalid)
|
|
32
|
+
validationText = `${this.$t('validation.maxValue')} ${this.v.maxValue.$params.max}`;
|
|
33
|
+
else if (this.v.sipAccountValidator?.$invalid)
|
|
34
|
+
validationText = this.$t('validation.sipAccountValidator');
|
|
35
|
+
else if (this.v.minLength?.$invalid)
|
|
36
|
+
validationText = `${this.$t('validation.minLength')} ${this.v.minLength.$params.min}`;
|
|
32
37
|
else if (this.v.url?.$invalid) validationText = `${this.$t('validation.url')}`;
|
|
33
|
-
else if (this.v.regExpValidator?.$invalid)
|
|
38
|
+
else if (this.v.regExpValidator?.$invalid)
|
|
39
|
+
validationText = `${this.$t('validation.regExpValidator')}`;
|
|
34
40
|
else if (this.v.sameAs?.$invalid) validationText = `${this.$t('validation.sameAs')}`;
|
|
35
|
-
else if (this.v.domainValidator?.$invalid)
|
|
36
|
-
|
|
37
|
-
else if (this.v.
|
|
41
|
+
else if (this.v.domainValidator?.$invalid)
|
|
42
|
+
validationText = `${this.$t('validation.domainValidator')}`;
|
|
43
|
+
else if (this.v.decimalValidator?.$invalid)
|
|
44
|
+
validationText = `${this.$t('validation.decimalValidator')} ${this.v.decimalValidator.$params.count}`;
|
|
45
|
+
else if (this.v.websocketValidator?.$invalid)
|
|
46
|
+
validationText = `${this.$t('validation.websocketValidator')}`;
|
|
38
47
|
else if (this.v.integer?.$invalid) validationText = `${this.$t('validation.integer')}`;
|
|
39
|
-
else if (this.v.isRegExpMatched?.$invalid)
|
|
48
|
+
else if (this.v.isRegExpMatched?.$invalid)
|
|
49
|
+
validationText =
|
|
50
|
+
this.v.isRegExpMatched?.$params?.errorMessage ||
|
|
51
|
+
`${t('validation.isRegExpMatched')} ${this.v.isRegExpMatched?.$params?.regExp}`;
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
for (const { name, text } of this.customValidators) {
|
|
@@ -8,7 +8,6 @@ import applyTransform, {
|
|
|
8
8
|
} from '../../../api/transformers/index.js';
|
|
9
9
|
|
|
10
10
|
const PauseCauseAPIFactory = ({ instance, OpenAPIConfig }) => {
|
|
11
|
-
|
|
12
11
|
const service = new AgentServiceApiFactory(OpenAPIConfig, '', instance);
|
|
13
12
|
|
|
14
13
|
const getList = async ({ agentId }) => {
|
|
@@ -20,24 +19,17 @@ const PauseCauseAPIFactory = ({ instance, OpenAPIConfig }) => {
|
|
|
20
19
|
|
|
21
20
|
const allowChange = true;
|
|
22
21
|
try {
|
|
23
|
-
const response = await service.searchPauseCauseForAgent(
|
|
24
|
-
agentId,
|
|
25
|
-
allowChange,
|
|
26
|
-
);
|
|
22
|
+
const response = await service.searchPauseCauseForAgent(agentId, allowChange);
|
|
27
23
|
const { items, next } = applyTransform(response.data, [
|
|
28
24
|
snakeToCamel(),
|
|
29
25
|
merge(getDefaultGetListResponse()),
|
|
30
26
|
]);
|
|
31
27
|
return {
|
|
32
|
-
items: applyTransform(items, [
|
|
33
|
-
mergeEach(defaultObject),
|
|
34
|
-
]),
|
|
28
|
+
items: applyTransform(items, [mergeEach(defaultObject)]),
|
|
35
29
|
next,
|
|
36
30
|
};
|
|
37
31
|
} catch (err) {
|
|
38
|
-
throw applyTransform(err, [
|
|
39
|
-
notify,
|
|
40
|
-
]);
|
|
32
|
+
throw applyTransform(err, [notify]);
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
35
|
|
package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js
CHANGED
|
@@ -8,13 +8,13 @@ import WtCcAgentStatusSelect from '../wt-cc-agent-status-select.vue';
|
|
|
8
8
|
const pauseCauses = [{ name: 'jest1' }, { name: 'jest2' }];
|
|
9
9
|
const getAgentPauseCausesMock = vi.fn(() => ({ items: pauseCauses }));
|
|
10
10
|
// https://stackoverflow.com/a/63727813
|
|
11
|
-
vi.spyOn(PauseCauseAPIFactory, 'default')
|
|
12
|
-
|
|
11
|
+
vi.spyOn(PauseCauseAPIFactory, 'default').mockImplementation(() => ({
|
|
12
|
+
getList: getAgentPauseCausesMock,
|
|
13
|
+
}));
|
|
13
14
|
|
|
14
15
|
const agentStatusMock = vi.fn(() => {});
|
|
15
16
|
// https://stackoverflow.com/a/63727813
|
|
16
|
-
vi.spyOn(AgentStatusAPIFactory, 'default')
|
|
17
|
-
.mockImplementation(() => ({ patch: agentStatusMock }));
|
|
17
|
+
vi.spyOn(AgentStatusAPIFactory, 'default').mockImplementation(() => ({ patch: agentStatusMock }));
|
|
18
18
|
|
|
19
19
|
const agent = {
|
|
20
20
|
status: '',
|
|
@@ -38,36 +38,33 @@ describe('Wt Cc Agent Status Select', () => {
|
|
|
38
38
|
});
|
|
39
39
|
it('renders a component', () => {
|
|
40
40
|
const wrapper = shallowMount(WtCcAgentStatusSelect, mountOptions);
|
|
41
|
-
expect(wrapper.exists())
|
|
42
|
-
.toBe(true);
|
|
41
|
+
expect(wrapper.exists()).toBe(true);
|
|
43
42
|
});
|
|
44
43
|
it(`at wt-status-select "change" to "online" event, triggers agent status patch
|
|
45
44
|
with "online" status`, () => {
|
|
46
45
|
const wrapper = shallowMount(WtCcAgentStatusSelect, mountOptions);
|
|
47
|
-
wrapper.findComponent({ name: 'wt-status-select' })
|
|
48
|
-
.vm.$emit('change', AgentStatus.ONLINE);
|
|
46
|
+
wrapper.findComponent({ name: 'wt-status-select' }).vm.$emit('change', AgentStatus.ONLINE);
|
|
49
47
|
const reqPayload = {
|
|
50
|
-
status: AgentStatus.ONLINE,
|
|
48
|
+
status: AgentStatus.ONLINE,
|
|
49
|
+
agentId: agent.agentId,
|
|
50
|
+
payload: undefined,
|
|
51
51
|
};
|
|
52
52
|
expect(agentStatusMock).toHaveBeenCalledWith(reqPayload);
|
|
53
53
|
});
|
|
54
54
|
it('at wt-status-select "change" to "pause" event, pause causes are loaded', async () => {
|
|
55
55
|
const wrapper = shallowMount(WtCcAgentStatusSelect, mountOptions);
|
|
56
|
-
wrapper.findComponent({ name: 'wt-status-select' })
|
|
57
|
-
.vm.$emit('change', AgentStatus.PAUSE);
|
|
56
|
+
wrapper.findComponent({ name: 'wt-status-select' }).vm.$emit('change', AgentStatus.PAUSE);
|
|
58
57
|
await wrapper.vm.$nextTick();
|
|
59
58
|
expect(getAgentPauseCausesMock).toHaveBeenCalled();
|
|
60
59
|
});
|
|
61
60
|
it(`at wt-status-select "change" to "pause" event and pause causes truthy response,
|
|
62
61
|
pause-cause-popup appears`, async () => {
|
|
63
62
|
const wrapper = mount(WtCcAgentStatusSelect, mountOptions);
|
|
64
|
-
wrapper.findComponent({ name: 'wt-status-select' })
|
|
65
|
-
.vm.$emit('change', AgentStatus.PAUSE);
|
|
63
|
+
wrapper.findComponent({ name: 'wt-status-select' }).vm.$emit('change', AgentStatus.PAUSE);
|
|
66
64
|
await wrapper.vm.$nextTick(); // load pause causes
|
|
67
65
|
await wrapper.vm.$nextTick();
|
|
68
66
|
await wrapper.vm.$nextTick(); // render popup
|
|
69
|
-
expect(wrapper.findComponent({ name: 'pause-cause-popup' }).isVisible())
|
|
70
|
-
.toBe(true);
|
|
67
|
+
expect(wrapper.findComponent({ name: 'pause-cause-popup' }).isVisible()).toBe(true);
|
|
71
68
|
});
|
|
72
69
|
it(`at pause-cause-popup "change" event, triggers patch agent status
|
|
73
70
|
with "pause" status and passed pauseCause`, async () => {
|
|
@@ -76,10 +73,11 @@ describe('Wt Cc Agent Status Select', () => {
|
|
|
76
73
|
wrapper.vm.openPauseCausePopup();
|
|
77
74
|
await wrapper.vm.$nextTick();
|
|
78
75
|
await wrapper.vm.$nextTick();
|
|
79
|
-
wrapper.findComponent({ name: 'pause-cause-popup' })
|
|
80
|
-
.vm.$emit('change', pauseCause);
|
|
76
|
+
wrapper.findComponent({ name: 'pause-cause-popup' }).vm.$emit('change', pauseCause);
|
|
81
77
|
const reqPayload = {
|
|
82
|
-
status: AgentStatus.PAUSE,
|
|
78
|
+
status: AgentStatus.PAUSE,
|
|
79
|
+
agentId: agent.agentId,
|
|
80
|
+
pauseCause,
|
|
83
81
|
};
|
|
84
82
|
expect(agentStatusMock).toHaveBeenCalledWith(reqPayload);
|
|
85
83
|
});
|
|
@@ -4,8 +4,7 @@ import WtCcPauseCausePopup from '../_internals/wt-cc-pause-cause-popup.vue';
|
|
|
4
4
|
describe('Pause cause popup', () => {
|
|
5
5
|
it('renders a component', () => {
|
|
6
6
|
const wrapper = shallowMount(WtCcPauseCausePopup);
|
|
7
|
-
expect(wrapper.exists())
|
|
8
|
-
.toBe(true);
|
|
7
|
+
expect(wrapper.exists()).toBe(true);
|
|
9
8
|
});
|
|
10
9
|
it('at option input event, sets "selected" its value', () => {
|
|
11
10
|
const value = 'jest';
|
|
@@ -57,9 +57,7 @@
|
|
|
57
57
|
<script setup>
|
|
58
58
|
import { computed, ref, toRef } from 'vue';
|
|
59
59
|
import { useI18n } from 'vue-i18n';
|
|
60
|
-
import {
|
|
61
|
-
useRepresentableAgentPauseCause,
|
|
62
|
-
} from '../../../../composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js';
|
|
60
|
+
import { useRepresentableAgentPauseCause } from '../../../../composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js';
|
|
63
61
|
|
|
64
62
|
const props = defineProps({
|
|
65
63
|
options: {
|
|
@@ -78,15 +76,17 @@ const { t } = useI18n();
|
|
|
78
76
|
|
|
79
77
|
const { representablePauseCause } = useRepresentableAgentPauseCause(options);
|
|
80
78
|
|
|
81
|
-
const pauseCause = computed(() =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
const pauseCause = computed(() =>
|
|
80
|
+
representablePauseCause.value.map((cause) => ({
|
|
81
|
+
...cause,
|
|
82
|
+
duration: cause.isOverflow
|
|
83
|
+
? `-${cause.durationMin - cause.limitMin} ${t('webitelUI.agentStatusSelect.pauseCausePopup.min')}`
|
|
84
|
+
: `${cause.durationMin} ${t('webitelUI.agentStatusSelect.pauseCausePopup.min')}`,
|
|
85
|
+
limit: cause.limitMin
|
|
86
|
+
? `${cause.limitMin} ${t('webitelUI.agentStatusSelect.pauseCausePopup.min')}`
|
|
87
|
+
: t('webitelUI.agentStatusSelect.pauseCausePopup.unlimited'),
|
|
88
|
+
})),
|
|
89
|
+
);
|
|
90
90
|
|
|
91
91
|
function select(option) {
|
|
92
92
|
selected.value = option;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:status="status"
|
|
5
5
|
:status-duration="statusDuration"
|
|
6
6
|
@closed="handleClosed"
|
|
7
|
-
@change="
|
|
7
|
+
@change="handleSelectInput"
|
|
8
8
|
/>
|
|
9
9
|
<pause-cause-popup
|
|
10
10
|
v-if="isPauseCausePopup"
|
|
@@ -54,6 +54,7 @@ const PauseCauseAPI = PauseCauseAPIFactory(api);
|
|
|
54
54
|
const isPauseCausePopup = ref(false);
|
|
55
55
|
const pauseCauses = ref([]);
|
|
56
56
|
const error = ref(null);
|
|
57
|
+
const chosenStatus = ref('');
|
|
57
58
|
|
|
58
59
|
function openPauseCausePopup() {
|
|
59
60
|
isPauseCausePopup.value = true;
|
|
@@ -83,21 +84,33 @@ async function changeStatus({ status, pauseCause }) {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
async function
|
|
87
|
-
if (status === props.status) return;
|
|
88
|
-
|
|
87
|
+
async function handleStatus(status) {
|
|
89
88
|
if (status === AgentStatus.PAUSE) {
|
|
90
89
|
await loadPauseCauses();
|
|
91
90
|
if (pauseCauses.value.length) {
|
|
92
91
|
openPauseCausePopup();
|
|
92
|
+
return;
|
|
93
93
|
}
|
|
94
|
-
} else {
|
|
95
|
-
await changeStatus({ status });
|
|
96
94
|
}
|
|
95
|
+
if (status === props.status) return;
|
|
96
|
+
await changeStatus({ status });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function handleSelectInput(newStatus) {
|
|
100
|
+
handleStatus(newStatus);
|
|
101
|
+
chosenStatus.value = newStatus;
|
|
102
|
+
// we need to save changes which come from input, because sometimes we want
|
|
103
|
+
// to choose 'pause' repeatedly and have to check the previous status
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
function handleClosed(event) {
|
|
100
|
-
|
|
107
|
+
// sometimes we want to choose 'pause' repeatedly
|
|
108
|
+
// but 'change' event from wt-status-select can't give us the same value,
|
|
109
|
+
// in this case we have to use value from 'closed' event to choose 'pause' status
|
|
110
|
+
if ((event.value === chosenStatus.value || !chosenStatus.value) // if closed status the same as chosen, or chosen status is empty
|
|
111
|
+
&& event.value === AgentStatus.PAUSE) { // and only for 'pause' status
|
|
112
|
+
handleStatus(event.value);
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
function handlePauseCauseInput(pauseCause) {
|
|
@@ -19,10 +19,8 @@ describe('WtDarkModeSwitcher', () => {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it('toggles dark mode class', async () => {
|
|
22
|
-
expect(window.document.documentElement.classList.contains('theme--dark'))
|
|
23
|
-
.toBe(false);
|
|
22
|
+
expect(window.document.documentElement.classList.contains('theme--dark')).toBe(false);
|
|
24
23
|
await wrapper.findComponent({ name: 'wt-switcher' }).trigger('change');
|
|
25
|
-
expect(window.document.documentElement.classList.contains('theme--dark'))
|
|
26
|
-
.toBe(true);
|
|
24
|
+
expect(window.document.documentElement.classList.contains('theme--dark')).toBe(true);
|
|
27
25
|
});
|
|
28
26
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import AuditFormQuestionReadWrapper
|
|
3
|
-
from '../audit-form-question-read-wrapper.vue';
|
|
2
|
+
import AuditFormQuestionReadWrapper from '../audit-form-question-read-wrapper.vue';
|
|
4
3
|
|
|
5
4
|
describe('AuditFormQuestionReadWrapper', () => {
|
|
6
5
|
it('renders a component', () => {
|
package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { EngineAuditQuestionType } from 'webitel-sdk';
|
|
3
|
-
import {
|
|
4
|
-
generateQuestionOptionsSchema,
|
|
5
|
-
} from '../../schemas/AuditFormQuestionOptionsSchema.js';
|
|
3
|
+
import { generateQuestionOptionsSchema } from '../../schemas/AuditFormQuestionOptionsSchema.js';
|
|
6
4
|
import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
} from '../../schemas/AuditFormQuestionScoreSchema.js';
|
|
10
|
-
import AuditFormQuestionWriteWrapper
|
|
11
|
-
from '../audit-form-question-write-wrapper.vue';
|
|
5
|
+
import { generateQuestionScoreSchema } from '../../schemas/AuditFormQuestionScoreSchema.js';
|
|
6
|
+
import AuditFormQuestionWriteWrapper from '../audit-form-question-write-wrapper.vue';
|
|
12
7
|
|
|
13
8
|
const v = { question: {} };
|
|
14
9
|
|
|
@@ -30,11 +25,8 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
30
25
|
v,
|
|
31
26
|
},
|
|
32
27
|
});
|
|
33
|
-
wrapper.findComponent({ name: 'wt-switcher' })
|
|
34
|
-
.
|
|
35
|
-
.$emit('change', !question.required);
|
|
36
|
-
expect(wrapper.emitted()['change:question'][0][0].required)
|
|
37
|
-
.toBe(!question.required);
|
|
28
|
+
wrapper.findComponent({ name: 'wt-switcher' }).vm.$emit('change', !question.required);
|
|
29
|
+
expect(wrapper.emitted()['change:question'][0][0].required).toBe(!question.required);
|
|
38
30
|
});
|
|
39
31
|
it('correctly changes question type to Score', () => {
|
|
40
32
|
const question = {};
|
|
@@ -44,12 +36,11 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
44
36
|
v,
|
|
45
37
|
},
|
|
46
38
|
});
|
|
47
|
-
wrapper
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
expect(wrapper.emitted()['change:question'][0][0])
|
|
52
|
-
.toEqual(generateQuestionScoreSchema());
|
|
39
|
+
wrapper
|
|
40
|
+
.find('.audit-form-question-write-content-question')
|
|
41
|
+
.findComponent({ name: 'wt-select' })
|
|
42
|
+
.vm.$emit('input', { value: EngineAuditQuestionType.Score });
|
|
43
|
+
expect(wrapper.emitted()['change:question'][0][0]).toEqual(generateQuestionScoreSchema());
|
|
53
44
|
});
|
|
54
45
|
it('correctly changes question type to Options', () => {
|
|
55
46
|
const question = {};
|
|
@@ -59,11 +50,10 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
59
50
|
v,
|
|
60
51
|
},
|
|
61
52
|
});
|
|
62
|
-
wrapper
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
expect(wrapper.emitted()['change:question'][0][0])
|
|
67
|
-
.toEqual(generateQuestionOptionsSchema());
|
|
53
|
+
wrapper
|
|
54
|
+
.find('.audit-form-question-write-content-question')
|
|
55
|
+
.findComponent({ name: 'wt-select' })
|
|
56
|
+
.vm.$emit('input', { value: EngineAuditQuestionType.Option });
|
|
57
|
+
expect(wrapper.emitted()['change:question'][0][0]).toEqual(generateQuestionOptionsSchema());
|
|
68
58
|
});
|
|
69
59
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
useDestroyableSortable,
|
|
5
|
-
} from '../../../../composables/useDestroyableSortable/useDestroyableSortable.js';
|
|
3
|
+
import { useDestroyableSortable } from '../../../../composables/useDestroyableSortable/useDestroyableSortable.js';
|
|
6
4
|
import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema.js';
|
|
7
5
|
import AuditForm from '../audit-form.vue';
|
|
8
6
|
|
|
@@ -32,8 +30,9 @@ describe('AuditForm', () => {
|
|
|
32
30
|
await wrapper.vm.$nextTick();
|
|
33
31
|
await wrapper.vm.$nextTick();
|
|
34
32
|
console.info(wrapper.html());
|
|
35
|
-
expect(wrapper.emitted()['update:questions'][0][0])
|
|
36
|
-
|
|
33
|
+
expect(wrapper.emitted()['update:questions'][0][0]).toEqual([
|
|
34
|
+
generateQuestionSchema({ required: true }),
|
|
35
|
+
]);
|
|
37
36
|
});
|
|
38
37
|
it('delete event from child question emits update without passed question', async () => {
|
|
39
38
|
const wrapper = mount(AuditForm, {
|
|
@@ -42,11 +41,8 @@ describe('AuditForm', () => {
|
|
|
42
41
|
questions: [generateQuestionSchema()],
|
|
43
42
|
},
|
|
44
43
|
});
|
|
45
|
-
await wrapper.findComponent({ name: 'audit-form-question' })
|
|
46
|
-
.
|
|
47
|
-
.$emit('delete', { key: 0 });
|
|
48
|
-
expect(wrapper.emitted()['update:questions'][0][0])
|
|
49
|
-
.toEqual([]);
|
|
44
|
+
await wrapper.findComponent({ name: 'audit-form-question' }).vm.$emit('delete', { key: 0 });
|
|
45
|
+
expect(wrapper.emitted()['update:questions'][0][0]).toEqual([]);
|
|
50
46
|
});
|
|
51
47
|
it('copy event from child question emits update with duplicated questions', async () => {
|
|
52
48
|
const question = generateQuestionSchema();
|
|
@@ -56,21 +52,16 @@ describe('AuditForm', () => {
|
|
|
56
52
|
questions: [question],
|
|
57
53
|
},
|
|
58
54
|
});
|
|
59
|
-
await wrapper
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
expect(wrapper.emitted()['update:questions'][0][0])
|
|
63
|
-
.toEqual([question, question]);
|
|
55
|
+
await wrapper
|
|
56
|
+
.findComponent({ name: 'audit-form-question' })
|
|
57
|
+
.vm.$emit('copy', { question, key: 0 });
|
|
58
|
+
expect(wrapper.emitted()['update:questions'][0][0]).toEqual([question, question]);
|
|
64
59
|
});
|
|
65
60
|
it('initializes result depending on passed questions', () => {
|
|
66
61
|
const wrapper = mount(AuditForm, {
|
|
67
62
|
props: {
|
|
68
63
|
mode: 'fill',
|
|
69
|
-
questions: [
|
|
70
|
-
generateQuestionSchema(),
|
|
71
|
-
generateQuestionSchema(),
|
|
72
|
-
generateQuestionSchema(),
|
|
73
|
-
],
|
|
64
|
+
questions: [generateQuestionSchema(), generateQuestionSchema(), generateQuestionSchema()],
|
|
74
65
|
},
|
|
75
66
|
});
|
|
76
67
|
expect(wrapper.emitted()['update:result'][0][0]).toEqual([{}, {}, {}]);
|
|
@@ -73,10 +73,7 @@ const props = defineProps({
|
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
const emit = defineEmits([
|
|
77
|
-
'change:result',
|
|
78
|
-
'activate',
|
|
79
|
-
]);
|
|
76
|
+
const emit = defineEmits(['change:result', 'activate']);
|
|
80
77
|
|
|
81
78
|
const QuestionTypeComponent = computed(() => {
|
|
82
79
|
if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
|