@webitel/ui-sdk 3.1.34 → 3.1.36
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.common.js +18140 -8528
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +18140 -8528
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +8 -9
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/components/index.js +0 -2
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +163 -145
- package/src/components/molecules/wt-input/wt-input.vue +2 -0
- package/src/css/components/molecules/wt-datepicker/_variables.scss +52 -17
- package/src/locale/i18n.js +1 -0
- package/src/modules/QueryFilters/components/filter-datetime.vue +3 -2
- package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +0 -82
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +0 -300
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.36",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve-lib": "vue-cli-service serve",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@vue/compat": "^3.2.47",
|
|
32
32
|
"@vuelidate/core": "^2.0.0",
|
|
33
33
|
"@vuelidate/validators": "^2.0.0",
|
|
34
|
+
"@vuepic/vue-datepicker": "^4.4.0",
|
|
34
35
|
"clipboard-copy": "^4.0.1",
|
|
35
36
|
"core-js": "^3.6.5",
|
|
36
37
|
"csv-stringify": "^5.5.3",
|
|
@@ -49,7 +50,6 @@
|
|
|
49
50
|
"vue-multiselect": "^3.0.0-beta.1",
|
|
50
51
|
"vue-observe-visibility": "^1.0.0",
|
|
51
52
|
"vue-router": "^4.1.6",
|
|
52
|
-
"vuejs-datepicker": "^1.6.2",
|
|
53
53
|
"webitel-sdk": "^0.1.184"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/components/index.js
CHANGED
|
@@ -14,7 +14,6 @@ import WtContextMenu from './atoms/wt-context-menu/wt-context-menu.vue';
|
|
|
14
14
|
|
|
15
15
|
import WtCheckbox from './molecules/wt-checkbox/wt-checkbox.vue';
|
|
16
16
|
import WtDatepicker from './molecules/wt-datepicker/wt-datepicker.vue';
|
|
17
|
-
import WtDatetimepicker from './molecules/wt-datetimepicker/wt-datetimepicker.vue';
|
|
18
17
|
import WtIconBtn from './molecules/wt-icon-btn/wt-icon-btn.vue';
|
|
19
18
|
import WtInput from './molecules/wt-input/wt-input.vue';
|
|
20
19
|
import WtNotification from './molecules/wt-notification/wt-notification.vue';
|
|
@@ -70,7 +69,6 @@ const Components = {
|
|
|
70
69
|
WtRoundedAction,
|
|
71
70
|
WtCheckbox,
|
|
72
71
|
WtDatepicker,
|
|
73
|
-
WtDatetimepicker,
|
|
74
72
|
WtIconBtn,
|
|
75
73
|
WtInput,
|
|
76
74
|
WtHint,
|
|
@@ -5,199 +5,217 @@
|
|
|
5
5
|
}"
|
|
6
6
|
class="wt-datepicker"
|
|
7
7
|
>
|
|
8
|
-
<wt-label v-bind="labelProps"
|
|
8
|
+
<wt-label :disabled="disabled" v-bind="labelProps">
|
|
9
9
|
<!-- @slot Custom input label -->
|
|
10
|
-
<slot v-bind="{ label }"
|
|
10
|
+
<slot name="label" v-bind="{ label }">{{ label }}</slot>
|
|
11
11
|
</wt-label>
|
|
12
12
|
<vue-datepicker
|
|
13
|
-
|
|
13
|
+
ref="datepicker"
|
|
14
|
+
:locale="locale"
|
|
15
|
+
:model-value="+value"
|
|
14
16
|
:placeholder="label || placeholder"
|
|
15
|
-
:value="+value"
|
|
16
17
|
class="wt-datepicker__datepicker"
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
v-bind="{ ...$attrs, ...$props }"
|
|
19
|
+
:format="isDateTime ? 'dd/MM/yyyy HH:mm' : 'dd/MM/yyyy'"
|
|
20
|
+
@closed="isOpened = false"
|
|
21
|
+
@open="isOpened = true"
|
|
22
|
+
@update:model-value="emit('input', $event.getTime())"
|
|
19
23
|
>
|
|
20
|
-
<template v-slot:
|
|
24
|
+
<template v-slot:input-icon>
|
|
21
25
|
<wt-icon
|
|
22
26
|
:color="disabled ? 'disabled' : 'default'"
|
|
23
|
-
class="wt-datepicker__calendar-icon"
|
|
24
27
|
icon="calendar"
|
|
25
28
|
></wt-icon>
|
|
29
|
+
</template>
|
|
30
|
+
<template v-slot:clear-icon>
|
|
26
31
|
<wt-icon
|
|
32
|
+
:class="{ 'wt-datepicker__open-arrow--opened': isOpened }"
|
|
27
33
|
:color="disabled ? 'disabled' : 'default'"
|
|
28
|
-
class="wt-
|
|
34
|
+
class="wt-datepicker__open-arrow"
|
|
29
35
|
icon="arrow-down"
|
|
30
36
|
></wt-icon>
|
|
31
37
|
</template>
|
|
32
|
-
<template v-slot:
|
|
33
|
-
<wt-icon
|
|
34
|
-
class="wt-datepicker__month-arrow wt-datepicker__month-arrow--left"
|
|
38
|
+
<template v-slot:arrow-left>
|
|
39
|
+
<wt-icon-btn
|
|
35
40
|
icon="arrow-left"
|
|
36
|
-
></wt-icon>
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
></wt-icon-btn>
|
|
42
|
+
</template>
|
|
43
|
+
<template v-slot:arrow-right>
|
|
44
|
+
<wt-icon-btn
|
|
39
45
|
icon="arrow-right"
|
|
40
|
-
></wt-icon>
|
|
46
|
+
></wt-icon-btn>
|
|
47
|
+
</template>
|
|
48
|
+
<template
|
|
49
|
+
v-if="isDateTime"
|
|
50
|
+
v-slot:time-picker="{ time, updateTime }"
|
|
51
|
+
>
|
|
52
|
+
<div class="datepicker__timepicker">
|
|
53
|
+
<wt-time-input
|
|
54
|
+
:label="$t('webitelUI.timepicker.hour')"
|
|
55
|
+
:value="time.hours"
|
|
56
|
+
max-value="23"
|
|
57
|
+
@input="updateTime"
|
|
58
|
+
></wt-time-input>
|
|
59
|
+
<wt-time-input
|
|
60
|
+
:label="$t('webitelUI.timepicker.min')"
|
|
61
|
+
:value="time.minutes"
|
|
62
|
+
max-value="59"
|
|
63
|
+
@input="updateTime($event, false)"
|
|
64
|
+
></wt-time-input>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
<template v-slot:action-select>
|
|
68
|
+
<wt-button
|
|
69
|
+
wide
|
|
70
|
+
@click="datepicker.selectDate()"
|
|
71
|
+
>{{ $t('reusable.ok') }}
|
|
72
|
+
</wt-button>
|
|
73
|
+
<wt-button
|
|
74
|
+
color="secondary"
|
|
75
|
+
wide
|
|
76
|
+
@click="datepicker.closeMenu()"
|
|
77
|
+
>{{ $t('reusable.cancel') }}
|
|
78
|
+
</wt-button>
|
|
41
79
|
</template>
|
|
42
80
|
</vue-datepicker>
|
|
43
81
|
</div>
|
|
44
82
|
</template>
|
|
45
83
|
|
|
46
|
-
<script>
|
|
47
|
-
import VueDatepicker from '
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
84
|
+
<script setup>
|
|
85
|
+
import VueDatepicker from '@vuepic/vue-datepicker';
|
|
86
|
+
import '@vuepic/vue-datepicker/dist/main.css';
|
|
87
|
+
import { computed, ref } from 'vue';
|
|
88
|
+
import { useI18n } from 'vue-i18n';
|
|
89
|
+
|
|
90
|
+
const props = defineProps({
|
|
91
|
+
mode: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: 'date',
|
|
94
|
+
options: ['date', 'datetime'],
|
|
53
95
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
default: 'Date.now()',
|
|
58
|
-
},
|
|
59
|
-
/**
|
|
60
|
-
* label above calendar input
|
|
61
|
-
*/
|
|
62
|
-
label: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: '',
|
|
65
|
-
},
|
|
66
|
-
placeholder: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: '',
|
|
69
|
-
},
|
|
70
|
-
format: {
|
|
71
|
-
type: [String, Function],
|
|
72
|
-
},
|
|
73
|
-
maximumView: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: 'day',
|
|
76
|
-
},
|
|
77
|
-
disabled: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: false,
|
|
80
|
-
},
|
|
81
|
-
disabledDates: {
|
|
82
|
-
type: Object,
|
|
83
|
-
},
|
|
84
|
-
lang: {
|
|
85
|
-
type: String,
|
|
86
|
-
default: 'en',
|
|
87
|
-
},
|
|
88
|
-
labelProps: {
|
|
89
|
-
type: Object,
|
|
90
|
-
description: 'Object with props, passed down to wt-label as props',
|
|
91
|
-
},
|
|
96
|
+
value: {
|
|
97
|
+
type: [String, Number],
|
|
98
|
+
default: 'Date.now()',
|
|
92
99
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
/**
|
|
101
|
+
* label above calendar input
|
|
102
|
+
*/
|
|
103
|
+
label: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: '',
|
|
96
106
|
},
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
placeholder: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: '',
|
|
110
|
+
},
|
|
111
|
+
disabled: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
115
|
+
disabledDates: {
|
|
116
|
+
type: Object,
|
|
117
|
+
},
|
|
118
|
+
lang: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: 'en',
|
|
121
|
+
},
|
|
122
|
+
labelProps: {
|
|
123
|
+
type: Object,
|
|
124
|
+
description: 'Object with props, passed down to wt-label as props',
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
const emit = defineEmits(['input']);
|
|
99
128
|
|
|
100
|
-
|
|
101
|
-
.wt-datepicker__calendar-icon {
|
|
102
|
-
position: absolute;
|
|
103
|
-
top: var(--spacing-xs);
|
|
104
|
-
left: var(--input-padding);
|
|
105
|
-
pointer-events: none;
|
|
106
|
-
}
|
|
129
|
+
const i18n = useI18n();
|
|
107
130
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
top: var(--spacing-xs);
|
|
111
|
-
right: var(--input-padding);
|
|
112
|
-
pointer-events: none;
|
|
113
|
-
}
|
|
131
|
+
const isOpened = ref(false);
|
|
132
|
+
const datepicker = ref(null); // template ref
|
|
114
133
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
134
|
+
const locale = computed(() => {
|
|
135
|
+
const { locale } = i18n;
|
|
136
|
+
if (locale === 'ua') return 'uk';
|
|
137
|
+
return locale;
|
|
138
|
+
});
|
|
119
139
|
|
|
120
|
-
|
|
140
|
+
const isDateTime = props.mode === 'datetime';
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<style lang="scss" scoped>
|
|
144
|
+
.wt-datepicker :deep(.dp__main) {
|
|
145
|
+
.dp__input_icon {
|
|
146
|
+
left: var(--spacing-xs);
|
|
147
|
+
line-height: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.dp__clear_icon {
|
|
121
151
|
right: var(--spacing-xs);
|
|
152
|
+
line-height: 0;
|
|
122
153
|
}
|
|
123
154
|
|
|
124
|
-
|
|
125
|
-
|
|
155
|
+
.dp__input {
|
|
156
|
+
line-height: 24px;
|
|
126
157
|
}
|
|
127
|
-
}
|
|
128
158
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// preview input
|
|
133
|
-
> div:first-child {
|
|
134
|
-
position: relative;
|
|
135
|
-
|
|
136
|
-
input {
|
|
137
|
-
@extend %typo-body-1;
|
|
138
|
-
@include wt-placeholder;
|
|
139
|
-
box-sizing: border-box;
|
|
140
|
-
width: 100%;
|
|
141
|
-
padding: var(--datepicker-padding);
|
|
142
|
-
border: var(--datepicker-border);
|
|
143
|
-
border-color: var(--form-border-color);
|
|
144
|
-
border-radius: var(--border-radius);
|
|
145
|
-
|
|
146
|
-
&:focus {
|
|
147
|
-
@include wt-placeholder('focus');
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.vdp-datepicker__calendar-button {
|
|
152
|
-
display: none;
|
|
153
|
-
}
|
|
159
|
+
.dp__arrow_top {
|
|
160
|
+
display: none;
|
|
154
161
|
}
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
/*
|
|
164
|
+
don't know why but month or year selection doesn't work
|
|
165
|
+
suppose its related to compatibility build
|
|
166
|
+
*/
|
|
167
|
+
.dp__month_year_wrap {
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
158
170
|
|
|
159
|
-
|
|
160
|
-
.
|
|
161
|
-
|
|
162
|
-
color: var(--form-label--hover-color);
|
|
171
|
+
// reset right/left arrow hover
|
|
172
|
+
.dp__inner_nav:hover {
|
|
173
|
+
background: inherit;
|
|
163
174
|
}
|
|
164
175
|
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
.dp__menu {
|
|
177
|
+
border-radius: var(--border-radius);
|
|
178
|
+
box-shadow: var(--elevation-10);
|
|
179
|
+
}
|
|
167
180
|
|
|
168
|
-
|
|
169
|
-
|
|
181
|
+
.dp__calendar_header_separator {
|
|
182
|
+
background: var(--secondary-color);
|
|
183
|
+
}
|
|
170
184
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
185
|
+
.dp__calendar_header,
|
|
186
|
+
.dp__calendar_row {
|
|
187
|
+
gap: var(--spacing-xs);
|
|
175
188
|
}
|
|
176
|
-
}
|
|
177
189
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
.vdp-datepicker__calendar-button:before {
|
|
182
|
-
transform: rotate(180deg);
|
|
183
|
-
}
|
|
190
|
+
// switch to time view
|
|
191
|
+
.dp__button {
|
|
192
|
+
display: none;
|
|
184
193
|
}
|
|
185
|
-
}
|
|
186
194
|
|
|
187
|
-
.
|
|
188
|
-
|
|
195
|
+
.dp__action_row {
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
gap: var(--spacing-xs);
|
|
198
|
+
}
|
|
189
199
|
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
.dp__selection_preview,
|
|
201
|
+
.dp__action_buttons {
|
|
202
|
+
width: 100%;
|
|
203
|
+
}
|
|
192
204
|
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
.dp__selection_preview {
|
|
206
|
+
text-align: center;
|
|
207
|
+
}
|
|
195
208
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
}
|
|
209
|
+
.dp__action_buttons {
|
|
210
|
+
display: flex;
|
|
211
|
+
gap: var(--spacing-xs);
|
|
201
212
|
}
|
|
202
213
|
}
|
|
214
|
+
|
|
215
|
+
.datepicker__timepicker {
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
justify-content: center;
|
|
219
|
+
gap: var(--spacing-xs);
|
|
220
|
+
}
|
|
203
221
|
</style>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
<input
|
|
23
23
|
:id="name"
|
|
24
24
|
ref="wt-input"
|
|
25
|
+
v-bind="$attrs"
|
|
25
26
|
:class="{
|
|
26
27
|
'wt-input--is-password': isPassword,
|
|
27
28
|
}"
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
:value="value || modelValue"
|
|
34
35
|
class="wt-input__input"
|
|
35
36
|
@input="inputHandler"
|
|
37
|
+
@keyup="$emit('keyup', $event)"
|
|
36
38
|
>
|
|
37
39
|
<div
|
|
38
40
|
ref="after-wrapper"
|
|
@@ -1,21 +1,56 @@
|
|
|
1
|
-
|
|
2
1
|
:root {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
--
|
|
11
|
-
--
|
|
2
|
+
/*General*/
|
|
3
|
+
--dp-font-family: 'Montserrat';
|
|
4
|
+
--dp-border-radius: var(--border-radius); /*Configurable border-radius*/
|
|
5
|
+
--dp-cell-border-radius: var(--border-radius); /*Specific border radius for the calendar cell*/
|
|
6
|
+
|
|
7
|
+
/*Sizing*/
|
|
8
|
+
--dp-button-heigh: 32px; /*Size for buttons in overlays*/
|
|
9
|
+
--dp-month-year-row-height: 32px; /*Height of the month-year select row*/
|
|
10
|
+
--dp-month-year-row-button-size: 32px; /*Specific height for the next/previous buttons*/
|
|
11
|
+
--dp-button-icon-height: var(--icon-md-size); /*Icon sizing in buttons*/
|
|
12
|
+
--dp-cell-size: 32px; /*Width and height of calendar cell*/
|
|
13
|
+
--dp-cell-padding: var(--spacing-2xs); /*Padding in the cell*/
|
|
14
|
+
--dp-common-padding: var(--spacing-xs); /*Common padding used*/
|
|
15
|
+
--dp-input-icon-padding: calc(var(--icon-md-size) + 2 * var(--spacing-xs)); /*Padding on the left side of the input if icon is present*/
|
|
16
|
+
--dp-input-padding: calc(var(--spacing-xs) - 1px) calc(var(--icon-md-size) + 2 * var(--spacing-xs)); /*Padding in the input*/
|
|
17
|
+
//--dp-menu-min-width: 260px; /*Adjust the min width of the menu*/
|
|
18
|
+
--dp-action-buttons-padding: 2px 5px; /*Adjust padding for the action buttons in action row*/
|
|
19
|
+
--dp-row-maring: var(--spacing-xs); /*Adjust the spacing between rows in the calendar*/
|
|
20
|
+
--dp-calendar-header-cell-padding: 0.5rem; /*Adjust padding in calendar header cells*/
|
|
21
|
+
--dp-two-calendars-spacing: 10px; /*Space between multiple calendars*/
|
|
22
|
+
--dp-overlay-col-padding: 3px; /*Padding in the overlay column*/
|
|
23
|
+
--dp-time-inc-dec-button-size: 32px; /*Sizing for arrow buttons in the time picker*/
|
|
12
24
|
|
|
13
|
-
|
|
14
|
-
--
|
|
15
|
-
--
|
|
16
|
-
--
|
|
25
|
+
/*Font sizes*/
|
|
26
|
+
--dp-font-size: 14px; /*Default font-size*/
|
|
27
|
+
--dp-preview-font-size: 12px; /*Font size of the date preview in the action row*/
|
|
28
|
+
--dp-time-font-size: 12px; /*Font size in the time picker*/
|
|
29
|
+
|
|
30
|
+
/*Transitions*/
|
|
31
|
+
--dp-animation-duration: var(--transition); /*Transition duration*/
|
|
32
|
+
--dp-menu-appear-transition-timing: cubic-bezier(.4, 0, 1, 1); /*Timing on menu appear animation*/
|
|
33
|
+
--dp-transition-timing: ease-out; /*Timing on slide animations*/
|
|
34
|
+
}
|
|
17
35
|
|
|
18
|
-
|
|
19
|
-
--
|
|
20
|
-
--
|
|
36
|
+
.dp__theme_light {
|
|
37
|
+
--dp-background-color: var(--main-color);
|
|
38
|
+
--dp-text-color: var(--contrast-color);
|
|
39
|
+
--dp-hover-color: var(--secondary-color-50);
|
|
40
|
+
--dp-hover-text-color: var(--contrast-color);
|
|
41
|
+
--dp-hover-icon-color: var(--icon-color--hover);
|
|
42
|
+
--dp-primary-color: var(--accent-color);
|
|
43
|
+
--dp-primary-text-color: var(--main-color);
|
|
44
|
+
--dp-secondary-color: var(--secondary-color);
|
|
45
|
+
--dp-border-color: var(--form-border-color);
|
|
46
|
+
--dp-menu-border-color: transparent;
|
|
47
|
+
--dp-border-color-hover: var(--form-border--hover-color);
|
|
48
|
+
--dp-disabled-color: var(--disabled-color);
|
|
49
|
+
//--dp-scroll-bar-background: #f3f3f3;
|
|
50
|
+
//--dp-scroll-bar-color: #959595;
|
|
51
|
+
--dp-success-color: var(--true-color);
|
|
52
|
+
//--dp-success-color-disabled: #a3d9b1;
|
|
53
|
+
--dp-icon-color: var(--icon-color);
|
|
54
|
+
--dp-danger-color: var(--false-color);
|
|
55
|
+
//--dp-highlight-color: rgba(25, 118, 210, 0.1);
|
|
21
56
|
}
|
package/src/locale/i18n.js
CHANGED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { shallowMount, mount } from '@vue/test-utils';
|
|
2
|
-
import FloatingVue, { Dropdown, Popper } from 'floating-vue';
|
|
3
|
-
import WtDatetimepicker from '../wt-datetimepicker.vue';
|
|
4
|
-
import WtLabel from '../../wt-label/wt-label.vue';
|
|
5
|
-
import WtIcon from '../../../atoms/wt-icon/wt-icon.vue';
|
|
6
|
-
import WtButton from '../../../atoms/wt-button/wt-button.vue';
|
|
7
|
-
|
|
8
|
-
describe('WtDatetimepicker', () => {
|
|
9
|
-
it('renders a component', () => {
|
|
10
|
-
const wrapper = shallowMount(WtDatetimepicker, {
|
|
11
|
-
global: {
|
|
12
|
-
plugins: [FloatingVue],
|
|
13
|
-
stubs: {
|
|
14
|
-
WtLabel,
|
|
15
|
-
WtIcon,
|
|
16
|
-
WtButton,
|
|
17
|
-
WtTimepicker: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
expect(wrapper.classes('wt-datetimepicker')).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('renders label text when passed', () => {
|
|
25
|
-
const label = 'Hello there';
|
|
26
|
-
const wrapper = mount(WtDatetimepicker, {
|
|
27
|
-
global: {
|
|
28
|
-
plugins: [FloatingVue],
|
|
29
|
-
stubs: {
|
|
30
|
-
WtLabel,
|
|
31
|
-
WtIcon,
|
|
32
|
-
WtButton,
|
|
33
|
-
WtTimepicker: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
props: { label },
|
|
37
|
-
});
|
|
38
|
-
expect(wrapper.find('.wt-label').text()).toBe(label);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('opens form at preview click', async () => {
|
|
42
|
-
const wrapper = shallowMount(WtDatetimepicker, {
|
|
43
|
-
// stubs: {
|
|
44
|
-
// WtLabel,
|
|
45
|
-
// WtIcon,
|
|
46
|
-
// WtButton,
|
|
47
|
-
// WtTimepicker: true,
|
|
48
|
-
// },
|
|
49
|
-
});
|
|
50
|
-
expect(wrapper.find('.wt-datetimepicker__form').element).not.toBeVisible();
|
|
51
|
-
wrapper.find('.wt-datetimepicker__preview').trigger('click');
|
|
52
|
-
await wrapper.vm.$nextTick();
|
|
53
|
-
expect(wrapper.find('.wt-datetimepicker__form').isVisible()).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// dunno how to test content of VDropdown popper template :(
|
|
57
|
-
// it('Triggers change event after button "add" click', async () => {
|
|
58
|
-
// const now = Date.now();
|
|
59
|
-
// const wrapper = mount(WtDatetimepicker, {
|
|
60
|
-
// localVue,
|
|
61
|
-
// stubs: {
|
|
62
|
-
// WtLabel,
|
|
63
|
-
// WtIcon,
|
|
64
|
-
// WtButton,
|
|
65
|
-
// VDropdown: Dropdown,
|
|
66
|
-
// WtTimepicker: true,
|
|
67
|
-
// },
|
|
68
|
-
// props: {
|
|
69
|
-
// value: now,
|
|
70
|
-
// },
|
|
71
|
-
// });
|
|
72
|
-
// wrapper.setData({ isOpened: true });
|
|
73
|
-
// // wrapper.find('.wt-datetimepicker__preview').trigger('keyup.enter');
|
|
74
|
-
// await wrapper.vm.$nextTick();
|
|
75
|
-
// await wrapper.vm.$nextTick();
|
|
76
|
-
// await wrapper.vm.$nextTick();
|
|
77
|
-
// console.info(wrapper.html());
|
|
78
|
-
// expect(wrapper.find('.wt-datetimepicker__form').exists()).toBe(true);
|
|
79
|
-
// wrapper.find('.wt-datetimepicker__actions > .wt-button').trigger('click');
|
|
80
|
-
// expect(wrapper.emitted().change.pop()).toEqual([now]);
|
|
81
|
-
// });
|
|
82
|
-
});
|