@webitel/ui-sdk 26.8.75 → 26.8.76
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/{clients-BmeOR90W.js → clients-oFIeYM2J.js} +66 -79
- package/dist/{components-C-ri6OSQ.js → components-BG2hOYak.js} +11 -11
- package/dist/{enums-BvonmHq2.js → enums-B_9ZBu01.js} +2 -2
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +3 -3
- package/dist/ui-sdk.umd.cjs +574 -574
- package/dist/{useValidation-0JwQGpLM.js → useValidation-CEed9cxY.js} +1 -1
- package/dist/{utils-CzBdLnFt.js → utils-BZHq8qMH.js} +1 -1
- package/dist/wt-action-bar-D74sgDCk.js +94 -0
- package/dist/{wt-button-D-nFhi1f.js → wt-button-CVjzcwNg.js} +2 -2
- package/dist/{wt-chat-emoji-CLhgb02d.js → wt-chat-emoji-CP1IO0Z_.js} +4 -4
- package/dist/{wt-datepicker-DCa23hYx.js → wt-datepicker-BgjjbOMX.js} +2 -2
- package/dist/{wt-display-chip-items-B7QLz9QM.js → wt-display-chip-items-BcuWCOui.js} +2 -2
- package/dist/{wt-dual-panel-D-LChluY.js → wt-dual-panel-Cs_Yzfxt.js} +1 -1
- package/dist/{wt-expansion-card-CToBA1fy.js → wt-expansion-card-BT586Mul.js} +1 -1
- package/dist/{wt-expansion-panel-af2t3VrM.js → wt-expansion-panel-kZmHSvPU.js} +1 -1
- package/dist/{wt-icon-WyFAGc4t.js → wt-icon-CAn_j3EL.js} +1 -1
- package/dist/{wt-icon-action-DYBTs3Mf.js → wt-icon-action-DJzm0kEk.js} +1 -1
- package/dist/{wt-icon-btn-BfhuUt8-.js → wt-icon-btn-BL0OfOZM.js} +1 -1
- package/dist/{wt-notifications-bar-CvKwuTEg.js → wt-notifications-bar-DZUTZhZy.js} +2 -2
- package/dist/{wt-player-B2etfN5v.js → wt-player-DbQuCEZb.js} +3 -3
- package/dist/{wt-screen-recordings-action-CepB2pqh.js → wt-screen-recordings-action-CVHZAWjl.js} +1 -1
- package/dist/{wt-search-bar-B4YkhgIB.js → wt-search-bar-DosqJLXT.js} +1 -1
- package/dist/{wt-send-message-popup-BhZ7K_Vs.js → wt-send-message-popup-B59bhE16.js} +2 -2
- package/dist/{wt-status-select-ELI7j73g.js → wt-status-select-Dnv9tj7o.js} +1 -1
- package/dist/{wt-timepicker-C3v9Cp2e.js → wt-timepicker-B4MOaSEZ.js} +2 -2
- package/dist/{wt-toast-DxQBRGm2.js → wt-toast-DJJg7o3S.js} +2 -2
- package/dist/{wt-tree-table-C5sxm-Eb.js → wt-tree-table-D-Jzijlk.js} +1 -1
- package/dist/{wt-type-extension-value-input-gQGgxMcJ.js → wt-type-extension-value-input-BEfx2uDx.js} +3 -3
- package/dist/{wt-vidstack-player-B37Mdf0u.js → wt-vidstack-player-efSk6APE.js} +4 -4
- package/package.json +1 -1
- package/src/components/transitions/__tests__/ExpandTransition.spec.js +15 -0
- package/src/components/transitions/__tests__/WtReplaceTransition.spec.js +66 -0
- package/src/components/transitions/__tests__/WtTransition.spec.js +35 -0
- package/src/components/wt-action-bar/WtActionBarActionsOrder.js +1 -1
- package/src/components/wt-action-bar/__tests__/WtActionBar.spec.js +121 -0
- package/src/components/wt-action-bar/wt-action-bar.vue +57 -33
- package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +65 -4
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +81 -2
- package/src/components/wt-avatar/__tests__/WtAvatar.spec.js +111 -0
- package/src/components/wt-badge/__tests__/WtBadge.spec.js +80 -0
- package/src/components/wt-badge-new/__tests__/WtBadge.spec.js +61 -0
- package/src/components/wt-breadcrumb/__tests__/WtBreadcrumb.spec.js +117 -0
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +37 -5
- package/src/components/wt-call-media-metric/__tests__/WtCallMediaMetric.spec.js +84 -0
- package/src/components/wt-card/__tests__/WtCard.spec.js +20 -0
- package/src/components/wt-checkbox/__tests__/WtCheckbox.spec.js +63 -0
- package/src/components/wt-chip/__tests__/WtChip.spec.js +32 -0
- package/src/components/wt-confirm-dialog/__tests__/WtConfirmDialog.spec.js +92 -0
- package/src/components/wt-context-menu/__tests__/WtContextMenu.spec.js +146 -1
- package/src/components/wt-copy-action/__tests__/WtCopyAction.spec.js +57 -0
- package/src/components/wt-datepicker/__tests__/WtDatepicker.spec.js +53 -0
- package/src/components/wt-datetime-text/__tests__/WtDatetimeText.spec.js +49 -0
- package/src/components/wt-divider/__tests__/WtDivider.spec.js +30 -0
- package/src/components/wt-dual-panel/__tests__/WtDualPanel.spec.js +120 -0
- package/src/components/wt-dummy/__tests__/WtDummy.spec.js +63 -1
- package/src/components/wt-empty/__tests__/WtEmpty.spec.js +84 -0
- package/src/components/wt-error-page/__tests__/WtErrorPage.spec.js +60 -0
- package/src/components/wt-expansion-card/__tests__/WtExpansionCard.spec.js +63 -0
- package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +48 -9
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +81 -10
- package/src/components/wt-hint/__tests__/WtHint.spec.js +44 -1
- package/src/components/wt-icon/__tests__/WtIcon.spec.js +29 -0
- package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +79 -0
- package/src/components/wt-icon-action/wt-icon-action.vue +1 -1
- package/src/components/wt-icon-btn/__tests__/WtIconBtn.spec.js +46 -0
- package/src/components/wt-image/__tests__/WtImage.spec.js +83 -0
- package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +23 -0
- package/src/components/wt-input-number/__tests__/WtInputNumber.spec.js +77 -0
- package/src/components/wt-input-text/__tests__/WtInputText.spec.js +85 -0
- package/src/components/wt-intersection-observer/__tests__/WtIntersectionObserver.spec.js +24 -3
- package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +93 -1
- package/src/components/wt-label/__tests__/WtLabel.spec.js +49 -1
- package/src/components/wt-load-bar/__tests__/WtLoadBar.spec.js +49 -0
- package/src/components/wt-loader/__tests__/WtLoader.spec.js +26 -1
- package/src/components/wt-logo/__tests__/WtLogo.spec.js +55 -0
- package/src/components/wt-menubar/__tests__/WtMenubar.spec.js +30 -0
- package/src/components/wt-message/__tests__/WtMessage.spec.js +46 -0
- package/src/components/wt-multi-select/__tests__/WtMultiSelect.spec.js +106 -0
- package/src/components/wt-page-header/__tests__/WtPageHeader.spec.js +111 -0
- package/src/components/wt-password/__tests__/WtPassword.spec.js +107 -0
- package/src/components/wt-popover/__tests__/WtPopover.spec.js +73 -0
- package/src/components/wt-progress-bar/__tests__/WtProgressBar.spec.js +34 -0
- package/src/components/wt-radio/__tests__/WtRadio.spec.js +45 -0
- package/src/components/wt-rounded-action/__tests__/WtRoundedAction.spec.js +48 -0
- package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +74 -13
- package/src/components/wt-single-select/__tests__/WtSingleSelect.spec.js +117 -0
- package/src/components/wt-slider/__tests__/WtSlider.spec.js +100 -0
- package/src/components/wt-stepper/__tests__/WtStepper.spec.js +105 -0
- package/src/components/wt-switcher/__tests__/WtSwitcher.spec.js +47 -0
- package/src/components/wt-table/__tests__/WtTable.spec.js +237 -0
- package/src/components/wt-table-actions/__tests__/WtTableActions.spec.js +153 -1
- package/src/components/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +147 -0
- package/src/components/wt-tabs/__tests__/WtTabs.spec.js +55 -0
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +49 -0
- package/src/components/wt-time-input/__tests__/WtTimeInput.spec.js +29 -0
- package/src/components/wt-tree/__tests__/WtTree.spec.js +126 -2
- package/src/components/wt-tree-line/__tests__/WtTreeLine.spec.js +205 -0
- package/src/components/wt-tree-table/__tests__/WtTreeTable.spec.js +155 -0
- package/src/components/wt-tree-table-row/__tests__/WtTreeTableRow.spec.js +176 -0
- package/src/components/wt-vidstack-player/__tests__/WtVidstackPlayer.spec.js +82 -0
- package/src/enums/IconAction/{IconAction.enum.js → IconAction.ts} +4 -2
- package/src/enums/index.ts +1 -1
- package/src/modules/ObjectPermissions/components/_internal/permissions-tab-content.vue +1 -1
- package/types/.tsbuildinfo +1 -1
- package/types/components/wt-action-bar/wt-action-bar.vue.d.ts +349 -105
- package/types/components/wt-datetime-text/__tests__/WtDatetimeText.spec.d.ts +1 -0
- package/types/components/wt-divider/__tests__/WtDivider.spec.d.ts +1 -0
- package/types/components/wt-dual-panel/__tests__/WtDualPanel.spec.d.ts +1 -0
- package/types/components/wt-empty/__tests__/WtEmpty.spec.d.ts +1 -0
- package/types/components/wt-error-page/__tests__/WtErrorPage.spec.d.ts +1 -0
- package/types/components/wt-expansion-card/__tests__/WtExpansionCard.spec.d.ts +1 -0
- package/types/components/wt-image/__tests__/WtImage.spec.d.ts +1 -0
- package/types/components/wt-input-number/__tests__/WtInputNumber.spec.d.ts +1 -0
- package/types/components/wt-input-text/__tests__/WtInputText.spec.d.ts +1 -0
- package/types/components/wt-logo/__tests__/WtLogo.spec.d.ts +1 -0
- package/types/components/wt-menubar/__tests__/WtMenubar.spec.d.ts +1 -0
- package/types/components/wt-message/__tests__/WtMessage.spec.d.ts +1 -0
- package/types/components/wt-multi-select/__tests__/WtMultiSelect.spec.d.ts +1 -0
- package/types/components/wt-page-header/__tests__/WtPageHeader.spec.d.ts +1 -0
- package/types/components/wt-password/__tests__/WtPassword.spec.d.ts +1 -0
- package/types/components/wt-popover/__tests__/WtPopover.spec.d.ts +1 -0
- package/types/components/wt-single-select/__tests__/WtSingleSelect.spec.d.ts +1 -0
- package/types/components/wt-slider/__tests__/WtSlider.spec.d.ts +1 -0
- package/types/components/wt-stepper/__tests__/WtStepper.spec.d.ts +1 -0
- package/types/components/wt-table/__tests__/WtTable.spec.d.ts +1 -0
- package/types/components/wt-tree-line/__tests__/WtTreeLine.spec.d.ts +1 -0
- package/types/components/wt-tree-table/__tests__/WtTreeTable.spec.d.ts +1 -0
- package/types/components/wt-tree-table-row/__tests__/WtTreeTableRow.spec.d.ts +1 -0
- package/types/components/wt-vidstack-player/__tests__/WtVidstackPlayer.spec.d.ts +1 -0
- package/types/enums/IconAction/IconAction.d.ts +31 -0
- package/types/enums/index.d.ts +1 -1
- package/dist/wt-action-bar-D4wDtBqb.js +0 -87
- package/src/components/wt-action-bar/__tests__/wt-action-bar.spec.js +0 -10
- package/src/components/wt-avatar/__tests__/wt-avatar.spec.js +0 -10
- package/src/components/wt-badge/__tests__/wt-badge.spec.js +0 -10
- package/src/components/wt-breadcrumb/__tests__/wt-breadcrumb.spec.js +0 -14
- package/src/components/wt-dual-panel/__tests__/WtDualPanel.js +0 -62
- package/src/components/wt-empty/__tests__/wt-empty.spec.js +0 -10
- package/src/components/wt-error-page/__tests__/wt-error-page.spec.js +0 -30
- package/src/components/wt-image/__tests__/wt-image.spec.js +0 -10
- package/src/components/wt-logo/__tests__/wt-logo.spec.js +0 -10
- package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +0 -10
- package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +0 -19
- package/types/enums/IconAction/IconAction.enum.d.ts +0 -30
- /package/types/components/{wt-action-bar/__tests__/wt-action-bar.spec.d.ts → transitions/__tests__/WtReplaceTransition.spec.d.ts} +0 -0
- /package/types/components/{wt-avatar/__tests__/wt-avatar.spec.d.ts → transitions/__tests__/WtTransition.spec.d.ts} +0 -0
- /package/types/components/{wt-badge/__tests__/wt-badge.spec.d.ts → wt-action-bar/__tests__/WtActionBar.spec.d.ts} +0 -0
- /package/types/components/{wt-breadcrumb/__tests__/wt-breadcrumb.spec.d.ts → wt-avatar/__tests__/WtAvatar.spec.d.ts} +0 -0
- /package/types/components/{wt-empty/__tests__/wt-empty.spec.d.ts → wt-badge/__tests__/WtBadge.spec.d.ts} +0 -0
- /package/types/components/{wt-dual-panel/__tests__/WtDualPanel.d.ts → wt-badge-new/__tests__/WtBadge.spec.d.ts} +0 -0
- /package/types/components/{wt-error-page/__tests__/wt-error-page.spec.d.ts → wt-breadcrumb/__tests__/WtBreadcrumb.spec.d.ts} +0 -0
- /package/types/components/{wt-image/__tests__/wt-image.spec.d.ts → wt-call-media-metric/__tests__/WtCallMediaMetric.spec.d.ts} +0 -0
- /package/types/components/{wt-logo/__tests__/wt-logo.spec.d.ts → wt-card/__tests__/WtCard.spec.d.ts} +0 -0
- /package/types/components/{wt-page-header/__tests__/wt-page-header.spec.d.ts → wt-confirm-dialog/__tests__/WtConfirmDialog.spec.d.ts} +0 -0
- /package/types/components/{wt-stepper/__tests__/WtStepper.spec.vue.d.ts → wt-copy-action/__tests__/WtCopyAction.spec.d.ts} +0 -0
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
v-bind="{ size }"
|
|
9
9
|
/>
|
|
10
10
|
|
|
11
|
+
<!-- @slot switcher here
|
|
12
|
+
@scope `{ size<ComponentSize> }`
|
|
13
|
+
-->
|
|
14
|
+
<slot
|
|
15
|
+
name="switcher"
|
|
16
|
+
v-bind="{ size }"
|
|
17
|
+
/>
|
|
18
|
+
|
|
11
19
|
<!-- @slot custom actions here
|
|
12
20
|
@scope `{ size<ComponentSize> }`
|
|
13
21
|
-->
|
|
@@ -23,7 +31,7 @@
|
|
|
23
31
|
>
|
|
24
32
|
<wt-icon-action
|
|
25
33
|
:action="action"
|
|
26
|
-
:disabled="
|
|
34
|
+
:disabled="isActionDisabled(action)"
|
|
27
35
|
v-bind="getActionProps(action)"
|
|
28
36
|
@click="handleActionClick(action)"
|
|
29
37
|
/>
|
|
@@ -31,26 +39,27 @@
|
|
|
31
39
|
</div>
|
|
32
40
|
</template>
|
|
33
41
|
|
|
34
|
-
<script setup>
|
|
35
|
-
import { computed } from 'vue';
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { computed, type PropType } from 'vue';
|
|
36
44
|
|
|
37
|
-
import IconAction from '../../enums
|
|
45
|
+
import { IconAction, type IconAction as IconActionValue } from '../../enums';
|
|
38
46
|
import { kebabToCamel } from '../../scripts/caseConverters.js';
|
|
39
|
-
import { SortSymbols } from '../../scripts/sortQueryAdapters.js';
|
|
40
47
|
import WtIconAction from '../wt-icon-action/wt-icon-action.vue';
|
|
41
48
|
import {
|
|
42
49
|
sectionActionsOrder,
|
|
43
50
|
tableActionsOrder,
|
|
44
51
|
} from './WtActionBarActionsOrder.js';
|
|
45
52
|
|
|
53
|
+
type SortOrder = 'asc' | 'desc' | null;
|
|
54
|
+
|
|
46
55
|
const props = defineProps({
|
|
47
56
|
/**
|
|
48
57
|
* [`'table'`, `'section'`]
|
|
49
|
-
|
|
58
|
+
*/
|
|
50
59
|
mode: {
|
|
51
|
-
type: String
|
|
60
|
+
type: String as PropType<'table' | 'section'>,
|
|
52
61
|
default: 'table',
|
|
53
|
-
validator: (v) =>
|
|
62
|
+
validator: (v: string) =>
|
|
54
63
|
[
|
|
55
64
|
'table',
|
|
56
65
|
'section',
|
|
@@ -62,59 +71,69 @@ const props = defineProps({
|
|
|
62
71
|
*/
|
|
63
72
|
size: {
|
|
64
73
|
type: String,
|
|
65
|
-
// default: 'md',
|
|
66
|
-
// validator: (v) => ['sm', 'md', 'lg'].includes(v),
|
|
67
74
|
},
|
|
68
75
|
|
|
69
76
|
/**
|
|
70
77
|
* Leave the default value for the mode only listed in includes prop
|
|
71
78
|
*/
|
|
72
|
-
|
|
73
79
|
include: {
|
|
74
|
-
type: Array
|
|
80
|
+
type: Array as PropType<IconActionValue[]>,
|
|
75
81
|
default: () => [],
|
|
76
82
|
},
|
|
77
83
|
|
|
78
84
|
/**
|
|
79
85
|
* Leave the default values for the mode, except for those in exclude prop
|
|
80
86
|
*/
|
|
81
|
-
|
|
82
87
|
exclude: {
|
|
83
|
-
type: Array
|
|
88
|
+
type: Array as PropType<IconActionValue[]>,
|
|
84
89
|
default: () => [],
|
|
85
90
|
},
|
|
86
91
|
|
|
87
92
|
'sort:order': {
|
|
88
|
-
type: String
|
|
93
|
+
type: String as unknown as PropType<SortOrder>,
|
|
89
94
|
default: null,
|
|
90
95
|
required: false,
|
|
91
|
-
validator: (v) =>
|
|
96
|
+
validator: (v: SortOrder) =>
|
|
97
|
+
[
|
|
98
|
+
'asc',
|
|
99
|
+
'desc',
|
|
100
|
+
null,
|
|
101
|
+
].includes(v),
|
|
92
102
|
},
|
|
93
103
|
|
|
94
104
|
/**
|
|
95
105
|
* Built dynamically on `disabled:[IconAction]` pattern for all available [IconActions](../../enums/IconAction/Readme.md).
|
|
96
106
|
*/
|
|
97
|
-
|
|
98
107
|
disabled: {
|
|
99
|
-
// Not implemented, but can be used to disable all actions
|
|
100
108
|
type: Boolean,
|
|
101
109
|
default: false,
|
|
102
110
|
},
|
|
103
111
|
|
|
104
|
-
...Object.values(IconAction).reduce((acc, action) => {
|
|
105
|
-
acc[`disabled:${action}`] = {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: false,
|
|
108
|
-
};
|
|
109
|
-
return acc;
|
|
110
|
-
}, {}),
|
|
111
|
-
});
|
|
112
|
-
const emit = defineEmits([
|
|
113
112
|
/**
|
|
114
|
-
*
|
|
113
|
+
* Vue SFC cannot resolve mapped types over imported `typeof` aliases, so
|
|
114
|
+
* `disabled:*` stay runtime-declared (same as pre-TS version).
|
|
115
115
|
*/
|
|
116
|
-
...Object.values(IconAction).
|
|
117
|
-
|
|
116
|
+
...Object.values(IconAction).reduce(
|
|
117
|
+
(acc, action) => {
|
|
118
|
+
acc[`disabled:${action}`] = {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
};
|
|
122
|
+
return acc;
|
|
123
|
+
},
|
|
124
|
+
{} as Record<
|
|
125
|
+
`disabled:${IconActionValue}`,
|
|
126
|
+
{
|
|
127
|
+
type: BooleanConstructor;
|
|
128
|
+
default: false;
|
|
129
|
+
}
|
|
130
|
+
>,
|
|
131
|
+
),
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const emit = defineEmits(
|
|
135
|
+
Object.values(IconAction).map((action) => `click:${action}` as const),
|
|
136
|
+
);
|
|
118
137
|
|
|
119
138
|
const shownActions = computed(() => {
|
|
120
139
|
const actionsOrder =
|
|
@@ -129,15 +148,20 @@ const shownActions = computed(() => {
|
|
|
129
148
|
return actionsOrder;
|
|
130
149
|
});
|
|
131
150
|
|
|
132
|
-
const handleActionClick = (action) => {
|
|
151
|
+
const handleActionClick = (action: IconActionValue) => {
|
|
133
152
|
emit(`click:${action}`);
|
|
134
153
|
};
|
|
135
154
|
|
|
136
|
-
const
|
|
155
|
+
const isActionDisabled = (action: IconActionValue): boolean => {
|
|
156
|
+
const key = `disabled:${kebabToCamel(action)}` as keyof typeof props;
|
|
157
|
+
return Boolean(props[key]);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const getActionProps = (action: IconActionValue) => {
|
|
137
161
|
switch (action) {
|
|
138
162
|
case IconAction.SORT:
|
|
139
163
|
return {
|
|
140
|
-
'sort:order': props['sort:order'],
|
|
164
|
+
'sort:order': props['sort:order'] ?? undefined,
|
|
141
165
|
};
|
|
142
166
|
default:
|
|
143
167
|
return {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
1
|
+
import { mount, shallowMount } from '@vue/test-utils';
|
|
2
2
|
|
|
3
3
|
import { WtApplication } from '@webitel/ui-sdk/enums';
|
|
4
4
|
import WtAppNavigator from '../wt-app-navigator.vue';
|
|
@@ -6,22 +6,24 @@ import WtAppNavigator from '../wt-app-navigator.vue';
|
|
|
6
6
|
const apps = [
|
|
7
7
|
{
|
|
8
8
|
name: WtApplication.Admin,
|
|
9
|
-
href: '',
|
|
9
|
+
href: '/admin',
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
name: WtApplication.History,
|
|
13
|
-
href: '',
|
|
13
|
+
href: '/history',
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: WtApplication.Supervisor,
|
|
17
|
-
href: '',
|
|
17
|
+
href: '/supervisor',
|
|
18
18
|
},
|
|
19
19
|
];
|
|
20
|
+
|
|
20
21
|
describe('WtAppNavigator', () => {
|
|
21
22
|
it('renders a component', () => {
|
|
22
23
|
const wrapper = shallowMount(WtAppNavigator);
|
|
23
24
|
expect(wrapper.classes('wt-app-navigator')).toBe(true);
|
|
24
25
|
});
|
|
26
|
+
|
|
25
27
|
it('renders specified app cards', () => {
|
|
26
28
|
const wrapper = shallowMount(WtAppNavigator, {
|
|
27
29
|
props: {
|
|
@@ -30,4 +32,63 @@ describe('WtAppNavigator', () => {
|
|
|
30
32
|
});
|
|
31
33
|
expect(wrapper.findAll('.wt-app-navigator__card').length).toBe(3);
|
|
32
34
|
});
|
|
35
|
+
|
|
36
|
+
it('renders app cards ordered by the fixed navigator order, not input order', () => {
|
|
37
|
+
const wrapper = shallowMount(WtAppNavigator, {
|
|
38
|
+
props: {
|
|
39
|
+
apps: [
|
|
40
|
+
{
|
|
41
|
+
name: WtApplication.Crm,
|
|
42
|
+
href: '',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: WtApplication.Agent,
|
|
46
|
+
href: '',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: WtApplication.Admin,
|
|
50
|
+
href: '',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const links = wrapper.findAll('.wt-app-navigator__card__link');
|
|
56
|
+
expect(links.map((l) => l.attributes('href'))).toEqual(
|
|
57
|
+
wrapper.vm.formattedApps.map((app) => app.href),
|
|
58
|
+
);
|
|
59
|
+
expect(wrapper.vm.formattedApps.map((app) => app.name)).toEqual([
|
|
60
|
+
WtApplication.Agent,
|
|
61
|
+
WtApplication.Admin,
|
|
62
|
+
WtApplication.Crm,
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('marks the current app as active', () => {
|
|
67
|
+
const wrapper = shallowMount(WtAppNavigator, {
|
|
68
|
+
props: {
|
|
69
|
+
apps,
|
|
70
|
+
currentApp: WtApplication.History,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const activeCard = wrapper.find('.wt-app-navigator__card.active');
|
|
74
|
+
expect(activeCard.exists()).toBe(true);
|
|
75
|
+
expect(activeCard.text()).toContain('History');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('is closed by default and toggles open when the trigger button is clicked', async () => {
|
|
79
|
+
const wrapper = mount(WtAppNavigator, {
|
|
80
|
+
props: {
|
|
81
|
+
apps,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
expect(wrapper.find('nav').attributes('style')).toContain('display: none');
|
|
85
|
+
|
|
86
|
+
await wrapper.find('.wt-app-navigator__btn').trigger('click');
|
|
87
|
+
expect(wrapper.find('nav').attributes('style') || '').not.toContain(
|
|
88
|
+
'display: none',
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
await wrapper.find('.wt-app-navigator__btn').trigger('click');
|
|
92
|
+
expect(wrapper.find('nav').attributes('style')).toContain('display: none');
|
|
93
|
+
});
|
|
33
94
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
1
|
+
import { mount, shallowMount } from '@vue/test-utils';
|
|
2
2
|
|
|
3
3
|
import WtHeaderActions from '../wt-header-actions.vue';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ describe('WtHeaderActions', () => {
|
|
|
8
8
|
expect(wrapper.classes('wt-header-actions')).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
it('renders user data', () => {
|
|
11
|
+
it('renders user data from name/account fields', () => {
|
|
12
12
|
const user = {
|
|
13
13
|
name: 'user nanme',
|
|
14
14
|
account: 'acc@ou.nt',
|
|
@@ -23,4 +23,83 @@ describe('WtHeaderActions', () => {
|
|
|
23
23
|
user.account,
|
|
24
24
|
);
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
it('falls back to username/preferredUsername fields', () => {
|
|
28
|
+
const user = {
|
|
29
|
+
username: 'fallback-username',
|
|
30
|
+
preferredUsername: 'fallback@account',
|
|
31
|
+
};
|
|
32
|
+
const wrapper = shallowMount(WtHeaderActions, {
|
|
33
|
+
props: {
|
|
34
|
+
user,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
expect(wrapper.find('.wt-header-actions__name').text()).toBe(user.username);
|
|
38
|
+
expect(wrapper.find('.wt-header-actions__account').text()).toBe(
|
|
39
|
+
user.preferredUsername,
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('does not render header when user has no name or account', () => {
|
|
44
|
+
const wrapper = shallowMount(WtHeaderActions);
|
|
45
|
+
expect(wrapper.find('.wt-header-actions__header').exists()).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('does not render footer when buildInfo is not passed', () => {
|
|
49
|
+
const wrapper = shallowMount(WtHeaderActions);
|
|
50
|
+
expect(wrapper.find('.wt-header-actions__footer').exists()).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('renders build version in footer when buildInfo is passed', () => {
|
|
54
|
+
const wrapper = shallowMount(WtHeaderActions, {
|
|
55
|
+
props: {
|
|
56
|
+
buildInfo: {
|
|
57
|
+
release: '1.2.3',
|
|
58
|
+
build: '456',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const footer = wrapper.find('.wt-header-actions__build__version');
|
|
63
|
+
expect(footer.exists()).toBe(true);
|
|
64
|
+
expect(footer.text()).toContain('1.2.3-456');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('emits settings and closes the panel when settings is clicked', async () => {
|
|
68
|
+
const wrapper = mount(WtHeaderActions);
|
|
69
|
+
await wrapper.find('.wt-header-actions__btn').trigger('click');
|
|
70
|
+
|
|
71
|
+
const settingsLink = wrapper.findAll('.wt-header-actions__action__link')[1];
|
|
72
|
+
await settingsLink.trigger('click');
|
|
73
|
+
expect(wrapper.emitted().settings).toBeTruthy();
|
|
74
|
+
expect(
|
|
75
|
+
wrapper.find('.wt-header-actions__panel-wrapper').attributes('style'),
|
|
76
|
+
).toContain('display: none');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('emits logout and closes the panel when logout is clicked', async () => {
|
|
80
|
+
const wrapper = mount(WtHeaderActions);
|
|
81
|
+
await wrapper.find('.wt-header-actions__btn').trigger('click');
|
|
82
|
+
|
|
83
|
+
const logoutLink = wrapper.find(
|
|
84
|
+
'.wt-header-actions__action--logout .wt-header-actions__action__link',
|
|
85
|
+
);
|
|
86
|
+
await logoutLink.trigger('click');
|
|
87
|
+
expect(wrapper.emitted().logout).toBeTruthy();
|
|
88
|
+
expect(
|
|
89
|
+
wrapper.find('.wt-header-actions__panel-wrapper').attributes('style'),
|
|
90
|
+
).toContain('display: none');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('toggles panel visibility when the account button is clicked', async () => {
|
|
94
|
+
const wrapper = mount(WtHeaderActions);
|
|
95
|
+
expect(
|
|
96
|
+
wrapper.find('.wt-header-actions__panel-wrapper').attributes('style'),
|
|
97
|
+
).toContain('display: none');
|
|
98
|
+
|
|
99
|
+
await wrapper.find('.wt-header-actions__btn').trigger('click');
|
|
100
|
+
const style =
|
|
101
|
+
wrapper.find('.wt-header-actions__panel-wrapper').attributes('style') ||
|
|
102
|
+
'';
|
|
103
|
+
expect(style).not.toContain('display: none');
|
|
104
|
+
});
|
|
26
105
|
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { mount, shallowMount } from '@vue/test-utils';
|
|
2
|
+
|
|
3
|
+
import AbstractUserStatus from '../../../enums/AbstractUserStatus/AbstractUserStatus.enum.js';
|
|
4
|
+
import WtAvatar from '../wt-avatar.vue';
|
|
5
|
+
|
|
6
|
+
describe('WtAvatar', () => {
|
|
7
|
+
it('renders a component', () => {
|
|
8
|
+
const wrapper = shallowMount(WtAvatar);
|
|
9
|
+
expect(wrapper.isVisible()).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('renders an image when src is provided', () => {
|
|
13
|
+
const wrapper = mount(WtAvatar, {
|
|
14
|
+
props: {
|
|
15
|
+
src: 'http://example.com/pic.png',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const img = wrapper.find('.wt-avatar__img');
|
|
19
|
+
expect(img.exists()).toBe(true);
|
|
20
|
+
expect(img.attributes('src')).toBe('http://example.com/pic.png');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders "N/A" letters when no src or username is provided', () => {
|
|
24
|
+
const wrapper = mount(WtAvatar);
|
|
25
|
+
expect(wrapper.find('.wt-avatar__img').exists()).toBe(false);
|
|
26
|
+
expect(wrapper.find('.wt-avatar__letters-text').text()).toBe('N/A');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders letters from username when src is not provided', () => {
|
|
30
|
+
const wrapper = mount(WtAvatar, {
|
|
31
|
+
props: {
|
|
32
|
+
username: 'John Doe',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
expect(wrapper.find('.wt-avatar__img').exists()).toBe(false);
|
|
36
|
+
expect(wrapper.find('.wt-avatar__letters-text').text()).toBe('JD');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders single letter for a single-word username', () => {
|
|
40
|
+
const wrapper = mount(WtAvatar, {
|
|
41
|
+
props: {
|
|
42
|
+
username: 'Cher',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
expect(wrapper.find('.wt-avatar__letters-text').text()).toBe('C');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('renders bot icon when bot prop is true, ignoring username/src', () => {
|
|
49
|
+
const wrapper = mount(WtAvatar, {
|
|
50
|
+
props: {
|
|
51
|
+
bot: true,
|
|
52
|
+
username: 'John Doe',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
expect(wrapper.find('.wt-avatar__bot').exists()).toBe(true);
|
|
56
|
+
expect(wrapper.find('.wt-avatar__letters-text').exists()).toBe(false);
|
|
57
|
+
expect(wrapper.find('.wt-avatar__img').exists()).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('does not render a badge by default', () => {
|
|
61
|
+
const wrapper = mount(WtAvatar, {
|
|
62
|
+
props: {
|
|
63
|
+
username: 'John Doe',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
expect(
|
|
67
|
+
wrapper
|
|
68
|
+
.findComponent({
|
|
69
|
+
name: 'wt-badge',
|
|
70
|
+
})
|
|
71
|
+
.exists(),
|
|
72
|
+
).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('renders a badge for eligible statuses when badge is true', () => {
|
|
76
|
+
const wrapper = mount(WtAvatar, {
|
|
77
|
+
props: {
|
|
78
|
+
badge: true,
|
|
79
|
+
status: AbstractUserStatus.ONLINE,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
const badge = wrapper.findComponent({
|
|
83
|
+
name: 'wt-badge',
|
|
84
|
+
});
|
|
85
|
+
expect(badge.exists()).toBe(true);
|
|
86
|
+
expect(badge.props('iconBadge')).toBe(AbstractUserStatus.ONLINE);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('renders a badge without an icon for non-eligible statuses when badge is true', () => {
|
|
90
|
+
const wrapper = mount(WtAvatar, {
|
|
91
|
+
props: {
|
|
92
|
+
badge: true,
|
|
93
|
+
status: AbstractUserStatus.OFFLINE,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
const badge = wrapper.findComponent({
|
|
97
|
+
name: 'wt-badge',
|
|
98
|
+
});
|
|
99
|
+
expect(badge.exists()).toBe(true);
|
|
100
|
+
expect(badge.props('iconBadge')).toBe(null);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('applies the size class', () => {
|
|
104
|
+
const wrapper = shallowMount(WtAvatar, {
|
|
105
|
+
props: {
|
|
106
|
+
size: 'lg',
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
expect(wrapper.classes()).toContain('p-avatar-lg');
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
|
|
3
|
+
import AbstractUserStatus from '../../../enums/AbstractUserStatus/AbstractUserStatus.enum.js';
|
|
4
|
+
import WtBadge from '../wt-badge.vue';
|
|
5
|
+
|
|
6
|
+
describe('WtBadge', () => {
|
|
7
|
+
it('renders a component', () => {
|
|
8
|
+
const wrapper = shallowMount(WtBadge);
|
|
9
|
+
expect(wrapper.isVisible()).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('applies compat-mode class when there is no default slot content', () => {
|
|
13
|
+
const wrapper = shallowMount(WtBadge);
|
|
14
|
+
expect(wrapper.classes()).toContain('wt-badge--compat-mode');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('does not apply compat-mode class when default slot has content', () => {
|
|
18
|
+
const wrapper = shallowMount(WtBadge, {
|
|
19
|
+
slots: {
|
|
20
|
+
default: 'content',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
expect(wrapper.classes()).not.toContain('wt-badge--compat-mode');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('applies the outside class when outside prop is true', () => {
|
|
27
|
+
const wrapper = shallowMount(WtBadge, {
|
|
28
|
+
props: {
|
|
29
|
+
outside: true,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
expect(wrapper.classes()).toContain('wt-badge--outside');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('hides the indicator when hidden prop is true', () => {
|
|
36
|
+
const wrapper = shallowMount(WtBadge, {
|
|
37
|
+
props: {
|
|
38
|
+
hidden: true,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
expect(wrapper.find('.wt-badge-indicator').attributes('style')).toContain(
|
|
42
|
+
'display: none',
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('does not render an icon pic when iconBadge is not a known status', () => {
|
|
47
|
+
const wrapper = shallowMount(WtBadge, {
|
|
48
|
+
props: {
|
|
49
|
+
iconBadge: 'unknown',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
expect(wrapper.find('.wt-badge-indicator__pic').exists()).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it.each([
|
|
56
|
+
AbstractUserStatus.DND,
|
|
57
|
+
AbstractUserStatus.ONLINE,
|
|
58
|
+
AbstractUserStatus.PAUSE,
|
|
59
|
+
])('renders an icon pic for iconBadge=%s', (status) => {
|
|
60
|
+
const wrapper = shallowMount(WtBadge, {
|
|
61
|
+
props: {
|
|
62
|
+
iconBadge: status,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
const pic = wrapper.find('.wt-badge-indicator__pic');
|
|
66
|
+
expect(pic.exists()).toBe(true);
|
|
67
|
+
expect(pic.attributes('alt')).toBe(status);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('applies the colorVariable as background color', () => {
|
|
71
|
+
const wrapper = shallowMount(WtBadge, {
|
|
72
|
+
props: {
|
|
73
|
+
colorVariable: 'success-color',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
expect(wrapper.find('.wt-badge-indicator').attributes('style')).toContain(
|
|
77
|
+
'var(--success-color)',
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
|
|
3
|
+
import { ComponentSize } from '../../../enums';
|
|
4
|
+
import WtBadge from '../wt-badge.vue';
|
|
5
|
+
|
|
6
|
+
describe('WtBadge (new)', () => {
|
|
7
|
+
it('renders a component', () => {
|
|
8
|
+
const wrapper = mount(WtBadge);
|
|
9
|
+
expect(wrapper.classes()).toContain('wt-badge');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('renders the value prop', () => {
|
|
13
|
+
const wrapper = mount(WtBadge, {
|
|
14
|
+
props: {
|
|
15
|
+
value: '5',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
expect(wrapper.text()).toContain('5');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('renders slot content', () => {
|
|
22
|
+
const wrapper = mount(WtBadge, {
|
|
23
|
+
slots: {
|
|
24
|
+
default: 'slot content',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
expect(wrapper.text()).toContain('slot content');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('applies the default md size class', () => {
|
|
31
|
+
const wrapper = mount(WtBadge);
|
|
32
|
+
expect(wrapper.classes()).toContain(`p-badge--${ComponentSize.MD}`);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('applies a custom size class', () => {
|
|
36
|
+
const wrapper = mount(WtBadge, {
|
|
37
|
+
props: {
|
|
38
|
+
size: ComponentSize.SM,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
expect(wrapper.classes()).toContain(`p-badge--${ComponentSize.SM}`);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('applies a severity class when provided', () => {
|
|
45
|
+
const wrapper = mount(WtBadge, {
|
|
46
|
+
props: {
|
|
47
|
+
severity: 'success',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
expect(wrapper.classes()).toContain('p-badge--success');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('does not apply a severity class when severity is null', () => {
|
|
54
|
+
const wrapper = mount(WtBadge);
|
|
55
|
+
expect(
|
|
56
|
+
wrapper
|
|
57
|
+
.classes()
|
|
58
|
+
.some((c) => c.startsWith('p-badge--') && c !== 'p-badge--md'),
|
|
59
|
+
).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
});
|