@king-design/intact 3.6.0-beta.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/button/demos/basic.md +0 -1
- package/components/cascader/index.spec.ts +7 -6
- package/components/copy/index.spec.ts +9 -14
- package/components/datepicker/basepicker.ts +26 -314
- package/components/datepicker/calendar.ts +3 -1
- package/components/datepicker/calendar.vdt +5 -2
- package/components/datepicker/dayjs.ts +2 -16
- package/components/datepicker/demos/multiple.md +5 -0
- package/components/datepicker/demos/yearMonth.md +2 -8
- package/components/datepicker/helpers.ts +5 -7
- package/components/datepicker/index.md +1 -2
- package/components/datepicker/index.spec.ts +596 -157
- package/components/datepicker/index.ts +16 -33
- package/components/datepicker/index.vdt +41 -35
- package/components/datepicker/shortcuts.ts +1 -1
- package/components/datepicker/styles.ts +27 -18
- package/components/datepicker/useConfirm.ts +82 -0
- package/components/datepicker/useDisabled.ts +29 -31
- package/components/datepicker/useFormats.ts +8 -4
- package/components/datepicker/useHighlight.ts +81 -0
- package/components/datepicker/useKeyboards.ts +2 -1
- package/components/datepicker/useMergeRange.ts +12 -12
- package/components/datepicker/useMonths.ts +6 -3
- package/components/datepicker/usePanel.ts +19 -19
- package/components/datepicker/useShowDate.ts +21 -41
- package/components/datepicker/useStatus.ts +34 -15
- package/components/datepicker/useValue.ts +43 -72
- package/components/datepicker/useValueBase.ts +312 -0
- package/components/datepicker/useWeeks.ts +1 -1
- package/components/datepicker/useYears.ts +7 -3
- package/components/dropdown/dropdown.ts +5 -4
- package/components/dropdown/index.md +1 -0
- package/components/dropdown/item.ts +1 -1
- package/components/dropdown/useKeyboard.ts +0 -1
- package/components/form/form.ts +4 -0
- package/components/form/index.md +2 -1
- package/components/form/index.spec.ts +2 -0
- package/components/input/index.spec.ts +42 -0
- package/components/input/index.ts +8 -0
- package/components/input/index.vdt +3 -4
- package/components/input/useAutoWidth.ts +19 -1
- package/components/menu/demos/horizontal.md +7 -1
- package/components/menu/index.spec.ts +19 -0
- package/components/menu/styles.ts +2 -1
- package/components/scrollSelect/useMouseEvents.ts +5 -4
- package/components/select/base.ts +3 -2
- package/components/select/base.vdt +2 -1
- package/components/select/demos/creatable.md +2 -2
- package/components/select/index.md +1 -1
- package/components/select/index.spec.ts +142 -36
- package/components/select/menu.ts +1 -1
- package/components/select/option.ts +2 -1
- package/components/select/select.ts +1 -0
- package/components/select/styles.ts +3 -1
- package/components/select/useCard.ts +22 -4
- package/components/select/useInput.ts +5 -9
- package/components/spinner/index.spec.ts +18 -0
- package/components/spinner/useValue.ts +2 -1
- package/components/table/index.spec.ts +69 -1
- package/components/table/useStickyHeader.ts +1 -1
- package/components/timepicker/index.spec.ts +145 -27
- package/components/timepicker/panelPicker.ts +10 -4
- package/components/timepicker/panelPicker.vdt +3 -5
- package/components/timepicker/styles.ts +1 -0
- package/components/timepicker/useConfirm.ts +33 -0
- package/components/timepicker/useDefaultValue.ts +30 -0
- package/components/timepicker/useDisabled.ts +17 -4
- package/components/timepicker/useFormats.ts +1 -1
- package/components/timepicker/useValue.ts +22 -19
- package/components/tour/index.spec.ts +1 -1
- package/es/components/cascader/index.spec.js +18 -19
- package/es/components/copy/index.spec.js +14 -31
- package/es/components/datepicker/basepicker.d.ts +6 -27
- package/es/components/datepicker/basepicker.js +23 -268
- package/es/components/datepicker/calendar.d.ts +4 -2
- package/es/components/datepicker/dayjs.d.ts +2 -13
- package/es/components/datepicker/helpers.d.ts +3 -2
- package/es/components/datepicker/helpers.js +2 -3
- package/es/components/datepicker/index.d.ts +21 -29
- package/es/components/datepicker/index.js +22 -32
- package/es/components/datepicker/index.spec.js +1277 -484
- package/es/components/datepicker/index.vdt.js +39 -38
- package/es/components/datepicker/shortcuts.d.ts +1 -1
- package/es/components/datepicker/styles.d.ts +7 -2
- package/es/components/datepicker/styles.js +10 -15
- package/es/components/datepicker/useConfirm.d.ts +6 -0
- package/es/components/datepicker/useConfirm.js +65 -0
- package/es/components/datepicker/useDisabled.d.ts +5 -3
- package/es/components/datepicker/useDisabled.js +22 -27
- package/es/components/datepicker/useFormats.d.ts +2 -2
- package/es/components/datepicker/useFormats.js +6 -2
- package/es/components/datepicker/useHighlight.d.ts +14 -0
- package/es/components/datepicker/useHighlight.js +60 -0
- package/es/components/datepicker/useKeyboards.js +2 -1
- package/es/components/datepicker/useMergeRange.d.ts +1 -1
- package/es/components/datepicker/useMergeRange.js +11 -16
- package/es/components/datepicker/useMonths.js +5 -3
- package/es/components/datepicker/usePanel.d.ts +1 -10
- package/es/components/datepicker/usePanel.js +19 -32
- package/es/components/datepicker/useShowDate.d.ts +1 -1
- package/es/components/datepicker/useShowDate.js +15 -40
- package/es/components/datepicker/useStatus.js +33 -16
- package/es/components/datepicker/useValue.d.ts +11 -6
- package/es/components/datepicker/useValue.js +49 -69
- package/es/components/datepicker/useValueBase.d.ts +28 -0
- package/es/components/datepicker/useValueBase.js +280 -0
- package/es/components/datepicker/useYears.js +6 -3
- package/es/components/dropdown/dropdown.d.ts +1 -0
- package/es/components/dropdown/dropdown.js +7 -4
- package/es/components/form/form.d.ts +1 -0
- package/es/components/form/form.js +7 -0
- package/es/components/form/index.spec.js +10 -8
- package/es/components/input/index.d.ts +2 -0
- package/es/components/input/index.js +6 -0
- package/es/components/input/index.spec.js +45 -0
- package/es/components/input/index.vdt.js +4 -3
- package/es/components/input/useAutoWidth.d.ts +2 -0
- package/es/components/input/useAutoWidth.js +19 -1
- package/es/components/menu/index.spec.js +28 -0
- package/es/components/menu/styles.js +2 -2
- package/es/components/scrollSelect/useMouseEvents.js +5 -4
- package/es/components/select/base.d.ts +1 -1
- package/es/components/select/base.js +3 -2
- package/es/components/select/base.vdt.js +4 -3
- package/es/components/select/index.spec.js +346 -218
- package/es/components/select/menu.js +1 -1
- package/es/components/select/option.js +2 -1
- package/es/components/select/select.js +2 -1
- package/es/components/select/styles.d.ts +79 -0
- package/es/components/select/styles.js +1 -0
- package/es/components/select/useCard.d.ts +4 -3
- package/es/components/select/useCard.js +15 -4
- package/es/components/select/useInput.d.ts +1 -1
- package/es/components/select/useInput.js +4 -4
- package/es/components/spinner/index.spec.js +82 -44
- package/es/components/spinner/useValue.js +2 -1
- package/es/components/table/index.spec.js +84 -6
- package/es/components/table/useStickyHeader.js +1 -1
- package/es/components/timepicker/index.spec.js +298 -128
- package/es/components/timepicker/panelPicker.d.ts +21 -16
- package/es/components/timepicker/panelPicker.js +7 -4
- package/es/components/timepicker/panelPicker.vdt.js +5 -9
- package/es/components/timepicker/selectPicker.d.ts +4 -3
- package/es/components/timepicker/styles.js +1 -1
- package/es/components/timepicker/useConfirm.d.ts +6 -0
- package/es/components/timepicker/useConfirm.js +19 -0
- package/es/components/timepicker/useDefaultValue.d.ts +4 -0
- package/es/components/timepicker/useDefaultValue.js +27 -0
- package/es/components/timepicker/useDisabled.d.ts +6 -3
- package/es/components/timepicker/useDisabled.js +13 -4
- package/es/components/timepicker/useFormats.d.ts +1 -1
- package/es/components/timepicker/useValue.d.ts +13 -8
- package/es/components/timepicker/useValue.js +14 -15
- package/es/components/tour/index.spec.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/basic/react.js +0 -2
- package/es/site/data/components/datepicker/demos/multiple/index.d.ts +1 -0
- package/es/site/data/components/datepicker/demos/multiple/index.js +2 -1
- package/es/site/data/components/datepicker/demos/multiple/react.d.ts +1 -0
- package/es/site/data/components/datepicker/demos/multiple/react.js +13 -2
- package/es/site/data/components/datepicker/demos/yearMonth/index.d.ts +0 -2
- package/es/site/data/components/datepicker/demos/yearMonth/index.js +1 -3
- package/es/site/data/components/datepicker/demos/yearMonth/react.d.ts +0 -2
- package/es/site/data/components/datepicker/demos/yearMonth/react.js +1 -21
- package/es/site/data/components/menu/demos/horizontal/react.js +5 -1
- package/es/site/data/components/select/demos/creatable/react.js +2 -2
- package/es/site/data/components/select/demos/searchable/index.js +1 -1
- package/es/site/data/components/select/demos/searchable/react.js +1 -1
- package/es/site/data/components/tour/demos/customText/index.d.ts +19 -6
- package/es/site/data/components/tour/demos/customText/index.js +18 -17
- package/es/site/data/components/tour/demos/customText/react.d.ts +20 -6
- package/es/site/data/components/tour/demos/customText/react.js +31 -27
- package/es/test/demos.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/components/datepicker/demos/nowrap.md +0 -35
- package/components/datepicker/usePosition.ts +0 -169
- package/es/components/datepicker/usePosition.d.ts +0 -10
- package/es/components/datepicker/usePosition.js +0 -166
- package/es/site/data/components/datepicker/demos/nowrap/index.d.ts +0 -10
- package/es/site/data/components/datepicker/demos/nowrap/index.js +0 -19
- package/es/site/data/components/datepicker/demos/nowrap/react.d.ts +0 -10
- package/es/site/data/components/datepicker/demos/nowrap/react.js +0 -49
- package/es/site/data/components/tour/demos/customButtons/index.d.ts +0 -33
- package/es/site/data/components/tour/demos/customButtons/index.js +0 -55
- package/es/site/data/components/tour/demos/customButtons/react.d.ts +0 -33
- package/es/site/data/components/tour/demos/customButtons/react.js +0 -99
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
3
5
|
import _Array$from2 from "@babel/runtime-corejs3/core-js/array/from";
|
|
4
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
5
7
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
7
8
|
import BasicDemo from '~/components/datepicker/demos/basic';
|
|
8
9
|
import YearMonthDemo from '~/components/datepicker/demos/yearMonth';
|
|
9
10
|
import ClearableDemo from '~/components/datepicker/demos/clearable';
|
|
@@ -20,6 +21,41 @@ var now = new Date();
|
|
|
20
21
|
var year = now.getFullYear();
|
|
21
22
|
var startYear = Math.floor(year / 10) * 10;
|
|
22
23
|
var month = now.getMonth();
|
|
24
|
+
var dateString = dayjs(now).format('YYYY-MM-DD');
|
|
25
|
+
function clickConfirm(_x) {
|
|
26
|
+
return _clickConfirm.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
function _clickConfirm() {
|
|
29
|
+
_clickConfirm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(content) {
|
|
30
|
+
var confirm;
|
|
31
|
+
return _regeneratorRuntime.wrap(function _callee60$(_context64) {
|
|
32
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
_context64.next = 2;
|
|
35
|
+
return wait();
|
|
36
|
+
case 2:
|
|
37
|
+
confirm = content.querySelector('.k-datepicker-footer .k-btn');
|
|
38
|
+
confirm.click();
|
|
39
|
+
_context64.next = 6;
|
|
40
|
+
return wait();
|
|
41
|
+
case 6:
|
|
42
|
+
return _context64.abrupt("return", confirm);
|
|
43
|
+
case 7:
|
|
44
|
+
case "end":
|
|
45
|
+
return _context64.stop();
|
|
46
|
+
}
|
|
47
|
+
}, _callee60);
|
|
48
|
+
}));
|
|
49
|
+
return _clickConfirm.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
function checkDisplay(content, isShow) {
|
|
52
|
+
var className = content.className;
|
|
53
|
+
var isLeave = _includesInstanceProperty(className).call(className, '-leave-');
|
|
54
|
+
expect(isLeave).eql(!isShow);
|
|
55
|
+
}
|
|
56
|
+
function getDateString(date) {
|
|
57
|
+
return dayjs(now).date(date).format('YYYY-MM-DD');
|
|
58
|
+
}
|
|
23
59
|
describe('Datepicker', function () {
|
|
24
60
|
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
25
61
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -48,47 +84,135 @@ describe('Datepicker', function () {
|
|
|
48
84
|
case 5:
|
|
49
85
|
content = getElement('.k-datepicker-content');
|
|
50
86
|
content.querySelector('.k-calendar-item').click();
|
|
87
|
+
_context2.next = 9;
|
|
88
|
+
return wait();
|
|
89
|
+
case 9:
|
|
51
90
|
expect(instance.get('date')).to.be.string;
|
|
52
|
-
|
|
91
|
+
checkDisplay(content, false);
|
|
92
|
+
case 11:
|
|
53
93
|
case "end":
|
|
54
94
|
return _context2.stop();
|
|
55
95
|
}
|
|
56
96
|
}, _callee2);
|
|
57
97
|
})));
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
describe('datetime', function () {
|
|
99
|
+
it('basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
100
|
+
var _mount2, instance, element, input, content;
|
|
101
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
102
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
_mount2 = mount(DatetimeDemo), instance = _mount2[0], element = _mount2[1];
|
|
105
|
+
input = element.querySelector('.k-input');
|
|
106
|
+
input.click();
|
|
107
|
+
_context3.next = 5;
|
|
108
|
+
return wait();
|
|
109
|
+
case 5:
|
|
110
|
+
content = getElement('.k-datepicker-content'); // change to time panel
|
|
111
|
+
content.querySelector('.k-calendar-item').click();
|
|
112
|
+
_context3.next = 9;
|
|
113
|
+
return wait();
|
|
114
|
+
case 9:
|
|
115
|
+
dispatchEvent(content.querySelector('.k-scroll-select-item'), 'click');
|
|
116
|
+
content.querySelector('.k-datepicker-footer .k-btn').click();
|
|
117
|
+
expect(instance.get('datetime1').split(' ')[1]).eql('15:00:00');
|
|
118
|
+
case 12:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context3.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee3);
|
|
123
|
+
})));
|
|
124
|
+
it('skip select date and select time directly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
125
|
+
var _mount3, instance, element, input, content, show, _show, inputInner, confirm, activeHour;
|
|
126
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
127
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
_show = function _show3() {
|
|
130
|
+
_show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
131
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
132
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
input.click();
|
|
135
|
+
_context4.next = 3;
|
|
136
|
+
return wait();
|
|
137
|
+
case 3:
|
|
138
|
+
content = getElement('.k-datepicker-content');
|
|
139
|
+
case 4:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context4.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee4);
|
|
144
|
+
}));
|
|
145
|
+
return _show.apply(this, arguments);
|
|
146
|
+
};
|
|
147
|
+
show = function _show2() {
|
|
148
|
+
return _show.apply(this, arguments);
|
|
149
|
+
};
|
|
150
|
+
_mount3 = mount(DatetimeDemo), instance = _mount3[0], element = _mount3[1];
|
|
151
|
+
input = element.querySelector('.k-input');
|
|
152
|
+
_context5.next = 6;
|
|
153
|
+
return show();
|
|
154
|
+
case 6:
|
|
155
|
+
dispatchEvent(content.querySelector('.k-scroll-select-item'), 'click');
|
|
156
|
+
_context5.next = 9;
|
|
157
|
+
return wait();
|
|
158
|
+
case 9:
|
|
159
|
+
inputInner = input.querySelector('.k-input-inner');
|
|
160
|
+
expect(inputInner.value).eql(dateString + " 15:00:00");
|
|
161
|
+
expect(instance.get('datetime1')).eql(null);
|
|
162
|
+
// hide to reset selected state
|
|
163
|
+
document.body.click();
|
|
164
|
+
_context5.next = 15;
|
|
165
|
+
return wait();
|
|
166
|
+
case 15:
|
|
167
|
+
expect(inputInner.getAttribute('placeholder')).eql("\u8BF7\u9009\u62E9\u65E5\u671F\u548C\u65F6\u95F4");
|
|
168
|
+
expect(inputInner.value).eql('');
|
|
169
|
+
expect(instance.get('datetime1')).eql(null);
|
|
170
|
+
// show again
|
|
171
|
+
_context5.next = 20;
|
|
172
|
+
return show();
|
|
173
|
+
case 20:
|
|
174
|
+
dispatchEvent(content.querySelector('.k-scroll-select-item'), 'click');
|
|
175
|
+
_context5.next = 23;
|
|
176
|
+
return wait();
|
|
177
|
+
case 23:
|
|
178
|
+
confirm = content.querySelector('.k-datepicker-footer .k-btn');
|
|
179
|
+
confirm.click();
|
|
180
|
+
_context5.next = 27;
|
|
181
|
+
return wait();
|
|
182
|
+
case 27:
|
|
183
|
+
expect(inputInner.value).eql(dateString + " 15:00:00");
|
|
184
|
+
expect(instance.get('datetime1')).eql(dateString + " 15:00:00");
|
|
185
|
+
checkDisplay(content, false);
|
|
186
|
+
// change time
|
|
187
|
+
_context5.next = 32;
|
|
188
|
+
return show();
|
|
189
|
+
case 32:
|
|
190
|
+
activeHour = content.querySelector('.k-scroll-select-item.k-active');
|
|
191
|
+
dispatchEvent(activeHour.nextElementSibling, 'click');
|
|
192
|
+
_context5.next = 36;
|
|
193
|
+
return wait();
|
|
194
|
+
case 36:
|
|
195
|
+
confirm.click();
|
|
196
|
+
_context5.next = 39;
|
|
197
|
+
return wait();
|
|
198
|
+
case 39:
|
|
199
|
+
expect(instance.get('datetime1')).eql(dateString + " 16:00:00");
|
|
200
|
+
case 40:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context5.stop();
|
|
203
|
+
}
|
|
204
|
+
}, _callee5);
|
|
205
|
+
})));
|
|
206
|
+
});
|
|
207
|
+
it('year', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
208
|
+
var _mount4, instance, element, _element$querySelecto, yearInput, content, yearDom, nextYearDom;
|
|
209
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
210
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
87
211
|
case 0:
|
|
88
|
-
|
|
212
|
+
_mount4 = mount(YearMonthDemo), instance = _mount4[0], element = _mount4[1];
|
|
89
213
|
_element$querySelecto = element.querySelectorAll('.k-input'), yearInput = _element$querySelecto[0]; // year
|
|
90
214
|
yearInput.click();
|
|
91
|
-
|
|
215
|
+
_context6.next = 5;
|
|
92
216
|
return wait();
|
|
93
217
|
case 5:
|
|
94
218
|
content = getElement('.k-datepicker-content');
|
|
@@ -98,19 +222,19 @@ describe('Datepicker', function () {
|
|
|
98
222
|
expect(instance.get('year') - 1).eql(year);
|
|
99
223
|
case 10:
|
|
100
224
|
case "end":
|
|
101
|
-
return
|
|
225
|
+
return _context6.stop();
|
|
102
226
|
}
|
|
103
|
-
},
|
|
227
|
+
}, _callee6);
|
|
104
228
|
})));
|
|
105
|
-
it('month', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
106
|
-
var
|
|
107
|
-
return _regeneratorRuntime.wrap(function
|
|
108
|
-
while (1) switch (
|
|
229
|
+
it('month', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
230
|
+
var _mount5, instance, element, _element$querySelecto2, monthInput, content, monthDom, _instance$get$split, _year, _month;
|
|
231
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
232
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
109
233
|
case 0:
|
|
110
|
-
|
|
234
|
+
_mount5 = mount(YearMonthDemo), instance = _mount5[0], element = _mount5[1];
|
|
111
235
|
_element$querySelecto2 = element.querySelectorAll('.k-input'), monthInput = _element$querySelecto2[1]; // month
|
|
112
236
|
monthInput.click();
|
|
113
|
-
|
|
237
|
+
_context7.next = 5;
|
|
114
238
|
return wait();
|
|
115
239
|
case 5:
|
|
116
240
|
content = getElement('.k-datepicker-content');
|
|
@@ -120,67 +244,46 @@ describe('Datepicker', function () {
|
|
|
120
244
|
expect(+_year).eql(year);
|
|
121
245
|
expect(+_month - 1).eql(month);
|
|
122
246
|
case 11:
|
|
123
|
-
case "end":
|
|
124
|
-
return _context5.stop();
|
|
125
|
-
}
|
|
126
|
-
}, _callee5);
|
|
127
|
-
})));
|
|
128
|
-
it('week', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
129
|
-
var _mount5, instance, element, inputs, WeekInput, content, weekItem;
|
|
130
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
131
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
132
|
-
case 0:
|
|
133
|
-
_mount5 = mount(YearMonthDemo), instance = _mount5[0], element = _mount5[1];
|
|
134
|
-
inputs = element.querySelectorAll('.k-input');
|
|
135
|
-
WeekInput = inputs[2];
|
|
136
|
-
WeekInput.click();
|
|
137
|
-
_context6.next = 6;
|
|
138
|
-
return wait();
|
|
139
|
-
case 6:
|
|
140
|
-
content = getElement('.k-datepicker-content');
|
|
141
|
-
weekItem = content.querySelector('.week-row:nth-child(1) .k-week-number');
|
|
142
|
-
weekItem.click();
|
|
143
|
-
expect(instance.get('week')).to.match(/^\d{4}-\d+周$/);
|
|
144
|
-
case 10:
|
|
145
|
-
case "end":
|
|
146
|
-
return _context6.stop();
|
|
147
|
-
}
|
|
148
|
-
}, _callee6);
|
|
149
|
-
})));
|
|
150
|
-
it('quarter', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
151
|
-
var _mount6, instance, element, inputs, QuarterInput, content, quarterItem;
|
|
152
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
153
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
154
|
-
case 0:
|
|
155
|
-
_mount6 = mount(YearMonthDemo), instance = _mount6[0], element = _mount6[1];
|
|
156
|
-
inputs = element.querySelectorAll('.k-input');
|
|
157
|
-
QuarterInput = inputs[3];
|
|
158
|
-
QuarterInput.click();
|
|
159
|
-
_context7.next = 6;
|
|
160
|
-
return wait();
|
|
161
|
-
case 6:
|
|
162
|
-
content = getElement('.k-datepicker-content'); // 选择第一个季度
|
|
163
|
-
quarterItem = content.querySelector('.k-calendar-item:nth-child(1)');
|
|
164
|
-
quarterItem.click();
|
|
165
|
-
// 验证输入框的值是否包含Q1
|
|
166
|
-
expect(instance.get('quarter')).to.include('Q1');
|
|
167
|
-
case 10:
|
|
168
247
|
case "end":
|
|
169
248
|
return _context7.stop();
|
|
170
249
|
}
|
|
171
250
|
}, _callee7);
|
|
172
251
|
})));
|
|
252
|
+
// it('week', async () => {
|
|
253
|
+
// const [instance, element] = mount(YearMonthDemo);
|
|
254
|
+
// const inputs = element.querySelectorAll<HTMLElement>('.k-input');
|
|
255
|
+
// const weekInput = inputs[2];
|
|
256
|
+
// weekInput.click();
|
|
257
|
+
// await wait();
|
|
258
|
+
// const content = getElement('.k-datepicker-content')!;
|
|
259
|
+
// const weekItem = content.querySelector('.week-row:nth-child(1) .k-week-number') as HTMLElement;
|
|
260
|
+
// weekItem.click();
|
|
261
|
+
// expect(instance.get<string>('week')).to.match(/^\d{4}-\d+周$/)
|
|
262
|
+
// });
|
|
263
|
+
// it('quarter', async () => {
|
|
264
|
+
// const [instance, element] = mount(YearMonthDemo);
|
|
265
|
+
// const inputs = element.querySelectorAll<HTMLElement>('.k-input');
|
|
266
|
+
// const QuarterInput = inputs[3];
|
|
267
|
+
// QuarterInput.click();
|
|
268
|
+
// await wait();
|
|
269
|
+
// const content = getElement('.k-datepicker-content')!;
|
|
270
|
+
// // 选择第一个季度
|
|
271
|
+
// const quarterItem = content.querySelector('.k-calendar-item:nth-child(1)') as HTMLElement;
|
|
272
|
+
// quarterItem.click();
|
|
273
|
+
// // 验证输入框的值是否包含Q1
|
|
274
|
+
// expect(instance.get<string>('quarter')).to.include('Q1')
|
|
275
|
+
// });
|
|
173
276
|
});
|
|
174
277
|
describe('Panel', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
175
278
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
176
279
|
while (1) switch (_context12.prev = _context12.next) {
|
|
177
280
|
case 0:
|
|
178
281
|
it('single date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
179
|
-
var
|
|
282
|
+
var _mount6, instance, element, input, content, _Array$from, prevYear, prevMonth, _Array$from3, nextMonth, nextYear, curDate, _Array$from4, yearDom, monthDom, curDate1, curMonth;
|
|
180
283
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
181
284
|
while (1) switch (_context8.prev = _context8.next) {
|
|
182
285
|
case 0:
|
|
183
|
-
|
|
286
|
+
_mount6 = mount(BasicDemo), instance = _mount6[0], element = _mount6[1];
|
|
184
287
|
input = element.querySelector('.k-input');
|
|
185
288
|
input.click();
|
|
186
289
|
_context8.next = 5;
|
|
@@ -240,11 +343,11 @@ describe('Datepicker', function () {
|
|
|
240
343
|
}, _callee8);
|
|
241
344
|
})));
|
|
242
345
|
it('range date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
243
|
-
var
|
|
346
|
+
var _mount7, instance, element, select, content, _content$querySelecto, panel1, panel2, _panel1$querySelector, nextMonth, nextYear, _content$querySelecto2, monthValues1, monthValues2, monthStart, yearStart, monthEnd, yearEnd, _panel2$querySelector, prevYear, firstDecadeStart, secondDecadeStart;
|
|
244
347
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
245
348
|
while (1) switch (_context9.prev = _context9.next) {
|
|
246
349
|
case 0:
|
|
247
|
-
|
|
350
|
+
_mount7 = mount(RangeDemo), instance = _mount7[0], element = _mount7[1];
|
|
248
351
|
select = element.querySelector('.k-datepicker');
|
|
249
352
|
select.click();
|
|
250
353
|
_context9.next = 5;
|
|
@@ -300,11 +403,11 @@ describe('Datepicker', function () {
|
|
|
300
403
|
}, _callee9);
|
|
301
404
|
})));
|
|
302
405
|
it('range year', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
303
|
-
var
|
|
406
|
+
var _mount8, instance, element, _element$querySelecto3, select, content, _content$querySelecto3, panel1, panel2, _panel1$querySelector2, next, _panel2$querySelector2, prev, _content$querySelecto4, label1, label2;
|
|
304
407
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
305
408
|
while (1) switch (_context10.prev = _context10.next) {
|
|
306
409
|
case 0:
|
|
307
|
-
|
|
410
|
+
_mount8 = mount(RangeDemo), instance = _mount8[0], element = _mount8[1];
|
|
308
411
|
_element$querySelecto3 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto3[2];
|
|
309
412
|
select.click();
|
|
310
413
|
_context10.next = 5;
|
|
@@ -336,11 +439,11 @@ describe('Datepicker', function () {
|
|
|
336
439
|
}, _callee10);
|
|
337
440
|
})));
|
|
338
441
|
it('range month', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
339
|
-
var
|
|
442
|
+
var _mount9, instance, element, _element$querySelecto4, select, content, _content$querySelecto5, panel1, panel2, _panel1$querySelector3, next, _panel2$querySelector3, prev, _content$querySelecto6, label1, label2;
|
|
340
443
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
341
444
|
while (1) switch (_context11.prev = _context11.next) {
|
|
342
445
|
case 0:
|
|
343
|
-
|
|
446
|
+
_mount9 = mount(RangeDemo), instance = _mount9[0], element = _mount9[1];
|
|
344
447
|
_element$querySelecto4 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto4[3];
|
|
345
448
|
select.click();
|
|
346
449
|
_context11.next = 5;
|
|
@@ -379,11 +482,11 @@ describe('Datepicker', function () {
|
|
|
379
482
|
})));
|
|
380
483
|
describe('Clear', function () {
|
|
381
484
|
it('date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
382
|
-
var
|
|
485
|
+
var _mount10, instance, element;
|
|
383
486
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
384
487
|
while (1) switch (_context13.prev = _context13.next) {
|
|
385
488
|
case 0:
|
|
386
|
-
|
|
489
|
+
_mount10 = mount(ClearableDemo), instance = _mount10[0], element = _mount10[1];
|
|
387
490
|
instance.set('date', '2018-03-04');
|
|
388
491
|
_context13.next = 4;
|
|
389
492
|
return wait();
|
|
@@ -397,11 +500,11 @@ describe('Datepicker', function () {
|
|
|
397
500
|
}, _callee13);
|
|
398
501
|
})));
|
|
399
502
|
it('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
400
|
-
var
|
|
503
|
+
var _mount11, instance, element, input, content;
|
|
401
504
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
402
505
|
while (1) switch (_context14.prev = _context14.next) {
|
|
403
506
|
case 0:
|
|
404
|
-
|
|
507
|
+
_mount11 = mount(DatetimeDemo), instance = _mount11[0], element = _mount11[1];
|
|
405
508
|
input = element.querySelector('.k-input');
|
|
406
509
|
input.click();
|
|
407
510
|
_context14.next = 5;
|
|
@@ -437,11 +540,11 @@ describe('Datepicker', function () {
|
|
|
437
540
|
});
|
|
438
541
|
describe('Multiple', function () {
|
|
439
542
|
it('date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
440
|
-
var
|
|
543
|
+
var _mount12, instance, element, select, content, items, close;
|
|
441
544
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
442
545
|
while (1) switch (_context15.prev = _context15.next) {
|
|
443
546
|
case 0:
|
|
444
|
-
|
|
547
|
+
_mount12 = mount(MultipleDemo), instance = _mount12[0], element = _mount12[1];
|
|
445
548
|
select = element.querySelector('.k-datepicker');
|
|
446
549
|
dispatchEvent(select, 'click');
|
|
447
550
|
_context15.next = 5;
|
|
@@ -479,11 +582,11 @@ describe('Datepicker', function () {
|
|
|
479
582
|
}, _callee15);
|
|
480
583
|
})));
|
|
481
584
|
it('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
482
|
-
var
|
|
585
|
+
var _mount13, instance, element, _element$querySelecto5, select, content, activeHour, confirm;
|
|
483
586
|
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
484
587
|
while (1) switch (_context16.prev = _context16.next) {
|
|
485
588
|
case 0:
|
|
486
|
-
|
|
589
|
+
_mount13 = mount(MultipleDemo), instance = _mount13[0], element = _mount13[1];
|
|
487
590
|
_element$querySelecto5 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto5[1];
|
|
488
591
|
dispatchEvent(select, 'click');
|
|
489
592
|
_context16.next = 5;
|
|
@@ -523,32 +626,43 @@ describe('Datepicker', function () {
|
|
|
523
626
|
return wait();
|
|
524
627
|
case 29:
|
|
525
628
|
expect(instance.get('datetime')).have.lengthOf(2);
|
|
526
|
-
//
|
|
527
|
-
|
|
528
|
-
|
|
629
|
+
// select time directly
|
|
630
|
+
activeHour = content.querySelector('.k-scroll-select-item.k-active');
|
|
631
|
+
dispatchEvent(activeHour.nextElementSibling, 'click');
|
|
632
|
+
_context16.next = 34;
|
|
529
633
|
return wait();
|
|
530
|
-
case
|
|
531
|
-
instance.set('datetime', []);
|
|
634
|
+
case 34:
|
|
532
635
|
_context16.next = 36;
|
|
533
|
-
return
|
|
636
|
+
return clickConfirm(content);
|
|
534
637
|
case 36:
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
638
|
+
confirm = _context16.sent;
|
|
639
|
+
expect(instance.get('datetime')).have.lengthOf(3);
|
|
640
|
+
// select time firstly, then select date should only add one value
|
|
641
|
+
dispatchEvent(activeHour.nextElementSibling.nextElementSibling, 'click');
|
|
642
|
+
_context16.next = 41;
|
|
643
|
+
return wait();
|
|
644
|
+
case 41:
|
|
645
|
+
dispatchEvent(content.querySelector('.k-calendar-item:nth-child(19)'), 'click');
|
|
646
|
+
_context16.next = 44;
|
|
647
|
+
return wait();
|
|
648
|
+
case 44:
|
|
649
|
+
confirm.click();
|
|
650
|
+
_context16.next = 47;
|
|
651
|
+
return wait();
|
|
652
|
+
case 47:
|
|
653
|
+
expect(instance.get('datetime')).have.lengthOf(4);
|
|
654
|
+
case 48:
|
|
541
655
|
case "end":
|
|
542
656
|
return _context16.stop();
|
|
543
657
|
}
|
|
544
658
|
}, _callee16);
|
|
545
659
|
})));
|
|
546
660
|
it('year', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
547
|
-
var
|
|
661
|
+
var _mount14, instance, element, _element$querySelecto6, select, content;
|
|
548
662
|
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
549
663
|
while (1) switch (_context17.prev = _context17.next) {
|
|
550
664
|
case 0:
|
|
551
|
-
|
|
665
|
+
_mount14 = mount(MultipleDemo), instance = _mount14[0], element = _mount14[1];
|
|
552
666
|
_element$querySelecto6 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto6[2];
|
|
553
667
|
dispatchEvent(select, 'click');
|
|
554
668
|
_context17.next = 5;
|
|
@@ -581,11 +695,11 @@ describe('Datepicker', function () {
|
|
|
581
695
|
}, _callee17);
|
|
582
696
|
})));
|
|
583
697
|
it('month', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
584
|
-
var
|
|
698
|
+
var _mount15, instance, element, _element$querySelecto7, select, content;
|
|
585
699
|
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
586
700
|
while (1) switch (_context18.prev = _context18.next) {
|
|
587
701
|
case 0:
|
|
588
|
-
|
|
702
|
+
_mount15 = mount(MultipleDemo), instance = _mount15[0], element = _mount15[1];
|
|
589
703
|
_element$querySelecto7 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto7[3];
|
|
590
704
|
dispatchEvent(select, 'click');
|
|
591
705
|
_context18.next = 5;
|
|
@@ -617,281 +731,907 @@ describe('Datepicker', function () {
|
|
|
617
731
|
}
|
|
618
732
|
}, _callee18);
|
|
619
733
|
})));
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
while (1) switch (_context19.prev = _context19.next) {
|
|
734
|
+
describe('date range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
|
|
735
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
736
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
624
737
|
case 0:
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
738
|
+
it('date range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
739
|
+
var _mount16, instance, element, _element$querySelecto8, select, content, _content$querySelecto7, calendar1, calendar2, first, second, value1, third, fourth, value2;
|
|
740
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
741
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
742
|
+
case 0:
|
|
743
|
+
_mount16 = mount(MultipleDemo), instance = _mount16[0], element = _mount16[1];
|
|
744
|
+
_element$querySelecto8 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto8[4];
|
|
745
|
+
dispatchEvent(select, 'click');
|
|
746
|
+
_context19.next = 5;
|
|
747
|
+
return wait();
|
|
748
|
+
case 5:
|
|
749
|
+
content = getElement('.k-datepicker-content');
|
|
750
|
+
_content$querySelecto7 = content.querySelectorAll('.k-datepicker-calendar-time-wrapper'), calendar1 = _content$querySelecto7[0], calendar2 = _content$querySelecto7[1];
|
|
751
|
+
first = calendar1.querySelector('.k-calendar-item:not(.k-exceed)');
|
|
752
|
+
second = first.nextElementSibling;
|
|
753
|
+
first.click();
|
|
754
|
+
second.click();
|
|
755
|
+
_context19.next = 13;
|
|
756
|
+
return wait();
|
|
757
|
+
case 13:
|
|
758
|
+
value1 = ["" + getDateString(1), "" + getDateString(2)];
|
|
759
|
+
expect(instance.get('dateRange')).eql([value1]);
|
|
760
|
+
third = second.nextElementSibling;
|
|
761
|
+
fourth = third.nextElementSibling;
|
|
762
|
+
third.click();
|
|
763
|
+
fourth.click();
|
|
764
|
+
_context19.next = 21;
|
|
765
|
+
return wait();
|
|
766
|
+
case 21:
|
|
767
|
+
value2 = ["" + getDateString(3), "" + getDateString(4)];
|
|
768
|
+
expect(instance.get('dateRange')).eql([value1, value2]);
|
|
769
|
+
first.click();
|
|
770
|
+
second.click();
|
|
771
|
+
_context19.next = 27;
|
|
772
|
+
return wait();
|
|
773
|
+
case 27:
|
|
774
|
+
expect(instance.get('dateRange')).eql([value2]);
|
|
775
|
+
instance.set('dateRange', []);
|
|
776
|
+
_context19.next = 31;
|
|
777
|
+
return wait();
|
|
778
|
+
case 31:
|
|
779
|
+
first.click();
|
|
780
|
+
second.click();
|
|
781
|
+
_context19.next = 35;
|
|
782
|
+
return wait();
|
|
783
|
+
case 35:
|
|
784
|
+
expect(instance.get('dateRange')).eql([value1]);
|
|
785
|
+
case 36:
|
|
786
|
+
case "end":
|
|
787
|
+
return _context19.stop();
|
|
788
|
+
}
|
|
789
|
+
}, _callee19);
|
|
790
|
+
})));
|
|
791
|
+
it('hover status', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
|
|
792
|
+
var _mount17, instance, element, _element$querySelecto9, select, content, _content$querySelecto8, calendar1, calendar2, first, second;
|
|
793
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
794
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
795
|
+
case 0:
|
|
796
|
+
_mount17 = mount(MultipleDemo), instance = _mount17[0], element = _mount17[1];
|
|
797
|
+
instance.set('dateRange', [['2025-07-11', '2025-07-15']]);
|
|
798
|
+
_element$querySelecto9 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto9[4];
|
|
799
|
+
dispatchEvent(select, 'click');
|
|
800
|
+
_context20.next = 6;
|
|
801
|
+
return wait();
|
|
802
|
+
case 6:
|
|
803
|
+
content = getElement('.k-datepicker-content');
|
|
804
|
+
_content$querySelecto8 = content.querySelectorAll('.k-datepicker-calendar-time-wrapper'), calendar1 = _content$querySelecto8[0], calendar2 = _content$querySelecto8[1];
|
|
805
|
+
first = calendar1.querySelector('.k-calendar-item:not(.k-exceed)');
|
|
806
|
+
second = first.nextElementSibling;
|
|
807
|
+
dispatchEvent(first, 'mouseenter');
|
|
808
|
+
_context20.next = 13;
|
|
809
|
+
return wait();
|
|
810
|
+
case 13:
|
|
811
|
+
expect(second.classList.contains('k-in-range')).eql(false);
|
|
812
|
+
case 14:
|
|
813
|
+
case "end":
|
|
814
|
+
return _context20.stop();
|
|
815
|
+
}
|
|
816
|
+
}, _callee20);
|
|
817
|
+
})));
|
|
818
|
+
case 2:
|
|
819
|
+
case "end":
|
|
820
|
+
return _context21.stop();
|
|
821
|
+
}
|
|
822
|
+
}, _callee21);
|
|
823
|
+
})));
|
|
824
|
+
describe('datetime range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
|
|
825
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
826
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
827
|
+
case 0:
|
|
828
|
+
it('basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
829
|
+
var _mount18, instance, element, _element$querySelecto10, select, content, calendar1, first, second, inputInner, value1, third, fourth, value2, confirm;
|
|
830
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
831
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
832
|
+
case 0:
|
|
833
|
+
_mount18 = mount(MultipleDemo), instance = _mount18[0], element = _mount18[1];
|
|
834
|
+
_element$querySelecto10 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto10[5];
|
|
835
|
+
dispatchEvent(select, 'click');
|
|
836
|
+
_context22.next = 5;
|
|
837
|
+
return wait();
|
|
838
|
+
case 5:
|
|
839
|
+
content = getElement('.k-datepicker-content');
|
|
840
|
+
calendar1 = content.querySelector('.k-datepicker-wrapper');
|
|
841
|
+
first = calendar1.querySelector('.k-calendar-item:not(.k-exceed)');
|
|
842
|
+
second = first.nextElementSibling;
|
|
843
|
+
inputInner = select.querySelector('.k-input-inner');
|
|
844
|
+
first.click();
|
|
845
|
+
_context22.next = 13;
|
|
846
|
+
return clickConfirm(content);
|
|
847
|
+
case 13:
|
|
848
|
+
expect(inputInner.value).eql(getDateString(1) + " 00:00:00 ~");
|
|
849
|
+
second.click();
|
|
850
|
+
_context22.next = 17;
|
|
851
|
+
return wait();
|
|
852
|
+
case 17:
|
|
853
|
+
expect(inputInner.value).eql(getDateString(1) + " 00:00:00 ~ " + getDateString(2) + " 00:00:00");
|
|
854
|
+
_context22.next = 20;
|
|
855
|
+
return clickConfirm(content);
|
|
856
|
+
case 20:
|
|
857
|
+
value1 = [getDateString(1) + " 00:00:00", getDateString(2) + " 00:00:00"];
|
|
858
|
+
expect(instance.get('datetimeRange')).eql([value1]);
|
|
859
|
+
third = second.nextElementSibling;
|
|
860
|
+
fourth = third.nextElementSibling;
|
|
861
|
+
third.click();
|
|
862
|
+
_context22.next = 27;
|
|
863
|
+
return clickConfirm(content);
|
|
864
|
+
case 27:
|
|
865
|
+
fourth.click();
|
|
866
|
+
_context22.next = 30;
|
|
867
|
+
return clickConfirm(content);
|
|
868
|
+
case 30:
|
|
869
|
+
value2 = [getDateString(3) + " 00:00:00", getDateString(4) + " 00:00:00"];
|
|
870
|
+
expect(instance.get('datetimeRange')).eql([value1, value2]);
|
|
871
|
+
// selecting the same date time will do nothing
|
|
872
|
+
third.click();
|
|
873
|
+
_context22.next = 35;
|
|
874
|
+
return clickConfirm(content);
|
|
875
|
+
case 35:
|
|
876
|
+
fourth.click();
|
|
877
|
+
_context22.next = 38;
|
|
878
|
+
return clickConfirm(content);
|
|
879
|
+
case 38:
|
|
880
|
+
expect(instance.get('datetimeRange')).eql([value1, value2]);
|
|
881
|
+
instance.set('datetimeRange', []);
|
|
882
|
+
_context22.next = 42;
|
|
883
|
+
return wait();
|
|
884
|
+
case 42:
|
|
885
|
+
first.click();
|
|
886
|
+
_context22.next = 45;
|
|
887
|
+
return clickConfirm(content);
|
|
888
|
+
case 45:
|
|
889
|
+
second.click();
|
|
890
|
+
_context22.next = 48;
|
|
891
|
+
return clickConfirm(content);
|
|
892
|
+
case 48:
|
|
893
|
+
confirm = _context22.sent;
|
|
894
|
+
expect(instance.get('datetimeRange')).eql([value1]);
|
|
895
|
+
expect(confirm.classList.contains('k-disabled')).eql(true);
|
|
896
|
+
case 51:
|
|
897
|
+
case "end":
|
|
898
|
+
return _context22.stop();
|
|
899
|
+
}
|
|
900
|
+
}, _callee22);
|
|
901
|
+
})));
|
|
902
|
+
it('select time directly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
|
|
903
|
+
var _mount19, instance, element, _element$querySelecto11, select, content, calendar, activeHour;
|
|
904
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
905
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
906
|
+
case 0:
|
|
907
|
+
_mount19 = mount(MultipleDemo), instance = _mount19[0], element = _mount19[1];
|
|
908
|
+
_element$querySelecto11 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto11[5];
|
|
909
|
+
dispatchEvent(select, 'click');
|
|
910
|
+
_context23.next = 5;
|
|
911
|
+
return wait();
|
|
912
|
+
case 5:
|
|
913
|
+
content = getElement('.k-datepicker-content');
|
|
914
|
+
calendar = content.querySelector('.k-datepicker-wrapper');
|
|
915
|
+
activeHour = calendar.querySelector('.k-scroll-select-item.k-active');
|
|
916
|
+
activeHour.nextElementSibling.click();
|
|
917
|
+
_context23.next = 11;
|
|
918
|
+
return clickConfirm(content);
|
|
919
|
+
case 11:
|
|
920
|
+
activeHour.nextElementSibling.click();
|
|
921
|
+
_context23.next = 14;
|
|
922
|
+
return clickConfirm(content);
|
|
923
|
+
case 14:
|
|
924
|
+
expect(instance.get('datetimeRange')).to.eql([[dateString + " 01:00:00", dateString + " 02:00:00"]]);
|
|
925
|
+
case 15:
|
|
926
|
+
case "end":
|
|
927
|
+
return _context23.stop();
|
|
928
|
+
}
|
|
929
|
+
}, _callee23);
|
|
930
|
+
})));
|
|
931
|
+
case 2:
|
|
664
932
|
case "end":
|
|
665
|
-
return
|
|
933
|
+
return _context24.stop();
|
|
666
934
|
}
|
|
667
|
-
},
|
|
935
|
+
}, _callee24);
|
|
668
936
|
})));
|
|
669
937
|
});
|
|
670
938
|
describe('Range', function () {
|
|
671
|
-
|
|
672
|
-
var
|
|
673
|
-
return _regeneratorRuntime.wrap(function
|
|
674
|
-
while (1) switch (
|
|
939
|
+
describe('date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30() {
|
|
940
|
+
var instance, element, select, content, first;
|
|
941
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
942
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
675
943
|
case 0:
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
944
|
+
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
|
|
945
|
+
var result;
|
|
946
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
947
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
948
|
+
case 0:
|
|
949
|
+
result = mount(RangeDemo);
|
|
950
|
+
instance = result[0];
|
|
951
|
+
element = result[1];
|
|
952
|
+
// date
|
|
953
|
+
select = element.querySelector('.k-datepicker');
|
|
954
|
+
select.click();
|
|
955
|
+
_context25.next = 7;
|
|
956
|
+
return wait();
|
|
957
|
+
case 7:
|
|
958
|
+
content = getElement('.k-datepicker-content');
|
|
959
|
+
// select the middle date
|
|
960
|
+
first = content.querySelector('.k-calendar-item:nth-child(18)');
|
|
961
|
+
case 9:
|
|
962
|
+
case "end":
|
|
963
|
+
return _context25.stop();
|
|
964
|
+
}
|
|
965
|
+
}, _callee25);
|
|
966
|
+
})));
|
|
967
|
+
it('basic selection', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
|
|
968
|
+
var value;
|
|
969
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
970
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
971
|
+
case 0:
|
|
972
|
+
first.click();
|
|
973
|
+
_context26.next = 3;
|
|
974
|
+
return wait();
|
|
975
|
+
case 3:
|
|
976
|
+
expect(instance.get('date')).to.be.null;
|
|
977
|
+
// hover status
|
|
978
|
+
dispatchEvent(first.nextElementSibling.nextElementSibling, 'mouseenter');
|
|
979
|
+
_context26.next = 7;
|
|
980
|
+
return wait();
|
|
981
|
+
case 7:
|
|
982
|
+
expect(first.nextElementSibling.classList.contains('k-in-range')).to.be.true;
|
|
983
|
+
dispatchEvent(first.previousElementSibling.previousElementSibling, 'mouseenter');
|
|
984
|
+
_context26.next = 11;
|
|
985
|
+
return wait();
|
|
986
|
+
case 11:
|
|
987
|
+
expect(first.previousElementSibling.classList.contains('k-in-range')).to.be.true;
|
|
988
|
+
expect(first.nextElementSibling.classList.contains('k-in-range')).to.be.false;
|
|
989
|
+
dispatchEvent(first.previousElementSibling.previousElementSibling, 'click');
|
|
990
|
+
_context26.next = 16;
|
|
991
|
+
return wait();
|
|
992
|
+
case 16:
|
|
993
|
+
value = instance.get('date');
|
|
994
|
+
expect(value).have.lengthOf(2);
|
|
995
|
+
expect(value[0] < value[1]).to.be.true;
|
|
996
|
+
case 19:
|
|
997
|
+
case "end":
|
|
998
|
+
return _context26.stop();
|
|
999
|
+
}
|
|
1000
|
+
}, _callee26);
|
|
1001
|
+
})));
|
|
1002
|
+
it('select the same date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
|
|
1003
|
+
var value1;
|
|
1004
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
1005
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1006
|
+
case 0:
|
|
1007
|
+
// select the middle date
|
|
1008
|
+
first.click();
|
|
1009
|
+
first.click();
|
|
1010
|
+
_context27.next = 4;
|
|
1011
|
+
return wait();
|
|
1012
|
+
case 4:
|
|
1013
|
+
value1 = instance.get('date');
|
|
1014
|
+
expect(value1).have.lengthOf(2);
|
|
1015
|
+
expect(value1[0]).eql(value1[1]);
|
|
1016
|
+
case 7:
|
|
1017
|
+
case "end":
|
|
1018
|
+
return _context27.stop();
|
|
1019
|
+
}
|
|
1020
|
+
}, _callee27);
|
|
1021
|
+
})));
|
|
1022
|
+
it('cross months', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
|
|
1023
|
+
var second;
|
|
1024
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
1025
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1026
|
+
case 0:
|
|
1027
|
+
first.click();
|
|
1028
|
+
second = content.querySelector('.k-datepicker-calendar-time-wrapper:nth-child(2) .k-calendar-item:nth-child(19)');
|
|
1029
|
+
second.click();
|
|
1030
|
+
_context28.next = 5;
|
|
1031
|
+
return wait();
|
|
1032
|
+
case 5:
|
|
1033
|
+
expect(instance.get('date')).have.lengthOf(2);
|
|
1034
|
+
case 6:
|
|
1035
|
+
case "end":
|
|
1036
|
+
return _context28.stop();
|
|
1037
|
+
}
|
|
1038
|
+
}, _callee28);
|
|
1039
|
+
})));
|
|
1040
|
+
it('can select end date which is less than start date on selecting', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
|
|
1041
|
+
var first, inputInner;
|
|
1042
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
1043
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1044
|
+
case 0:
|
|
1045
|
+
// hide firstly
|
|
1046
|
+
document.body.click();
|
|
1047
|
+
_context29.next = 3;
|
|
1048
|
+
return wait();
|
|
1049
|
+
case 3:
|
|
1050
|
+
instance.set('date', ['2025-08-01', '2025-08-02']);
|
|
1051
|
+
_context29.next = 6;
|
|
1052
|
+
return wait();
|
|
1053
|
+
case 6:
|
|
1054
|
+
// show again
|
|
1055
|
+
select.click();
|
|
1056
|
+
_context29.next = 9;
|
|
1057
|
+
return wait();
|
|
1058
|
+
case 9:
|
|
1059
|
+
// select date 3
|
|
1060
|
+
first = content.querySelector('.k-calendar-item:not(.k-exceed):not(.k-active)');
|
|
1061
|
+
first.click();
|
|
1062
|
+
_context29.next = 13;
|
|
1063
|
+
return wait();
|
|
1064
|
+
case 13:
|
|
1065
|
+
inputInner = select.querySelector('.k-input-inner');
|
|
1066
|
+
expect(inputInner.value).eql('2025-08-03 ~ 2025-08-02');
|
|
1067
|
+
expect(instance.get('date')).eql(['2025-08-01', '2025-08-02']);
|
|
1068
|
+
// should update value after hiding
|
|
1069
|
+
document.body.click();
|
|
1070
|
+
_context29.next = 19;
|
|
1071
|
+
return wait();
|
|
1072
|
+
case 19:
|
|
1073
|
+
expect(inputInner.value).eql('2025-08-02 ~ 2025-08-03');
|
|
1074
|
+
expect(instance.get('date')).eql(['2025-08-02', '2025-08-03']);
|
|
1075
|
+
case 21:
|
|
1076
|
+
case "end":
|
|
1077
|
+
return _context29.stop();
|
|
1078
|
+
}
|
|
1079
|
+
}, _callee29);
|
|
1080
|
+
})));
|
|
681
1081
|
case 5:
|
|
682
|
-
content = getElement('.k-datepicker-content'); // select the middle date
|
|
683
|
-
first = content.querySelector('.k-calendar-item:nth-child(18)');
|
|
684
|
-
first.click();
|
|
685
|
-
_context20.next = 10;
|
|
686
|
-
return wait();
|
|
687
|
-
case 10:
|
|
688
|
-
expect(instance.get('date')).to.be.null;
|
|
689
|
-
// hover status
|
|
690
|
-
dispatchEvent(first.nextElementSibling.nextElementSibling, 'mouseenter');
|
|
691
|
-
_context20.next = 14;
|
|
692
|
-
return wait();
|
|
693
|
-
case 14:
|
|
694
|
-
expect(first.nextElementSibling.classList.contains('k-in-range')).to.be.true;
|
|
695
|
-
dispatchEvent(first.previousElementSibling.previousElementSibling, 'mouseenter');
|
|
696
|
-
_context20.next = 18;
|
|
697
|
-
return wait();
|
|
698
|
-
case 18:
|
|
699
|
-
expect(first.previousElementSibling.classList.contains('k-in-range')).to.be.true;
|
|
700
|
-
expect(first.nextElementSibling.classList.contains('k-in-range')).to.be.false;
|
|
701
|
-
dispatchEvent(first.previousElementSibling.previousElementSibling, 'click');
|
|
702
|
-
_context20.next = 23;
|
|
703
|
-
return wait();
|
|
704
|
-
case 23:
|
|
705
|
-
value = instance.get('date');
|
|
706
|
-
expect(value).have.lengthOf(2);
|
|
707
|
-
expect(value[0] < value[1]).to.be.true;
|
|
708
|
-
// select the same date
|
|
709
|
-
select.click();
|
|
710
|
-
_context20.next = 29;
|
|
711
|
-
return wait();
|
|
712
|
-
case 29:
|
|
713
|
-
// select the middle date
|
|
714
|
-
first.click();
|
|
715
|
-
first.click();
|
|
716
|
-
_context20.next = 33;
|
|
717
|
-
return wait();
|
|
718
|
-
case 33:
|
|
719
|
-
value1 = instance.get('date');
|
|
720
|
-
expect(value1).have.lengthOf(2);
|
|
721
|
-
expect(value1[0]).eql(value1[1]);
|
|
722
|
-
// cancel all of range values and re-select
|
|
723
|
-
select.click();
|
|
724
|
-
_context20.next = 39;
|
|
725
|
-
return wait();
|
|
726
|
-
case 39:
|
|
727
|
-
// select the middle date
|
|
728
|
-
first.click();
|
|
729
|
-
dispatchEvent(first.previousElementSibling.previousElementSibling, 'click');
|
|
730
|
-
_context20.next = 43;
|
|
731
|
-
return wait();
|
|
732
|
-
case 43:
|
|
733
|
-
first.click();
|
|
734
|
-
dispatchEvent(first.previousElementSibling.previousElementSibling, 'click');
|
|
735
|
-
expect(instance.get('date')).eql(value);
|
|
736
|
-
// range cross months
|
|
737
|
-
select.click();
|
|
738
|
-
_context20.next = 49;
|
|
739
|
-
return wait();
|
|
740
|
-
case 49:
|
|
741
|
-
first.click();
|
|
742
|
-
second = content.querySelector('.k-datepicker-calendar-time-wrapper:nth-child(2) .k-calendar-item:nth-child(19)');
|
|
743
|
-
second.click();
|
|
744
|
-
_context20.next = 54;
|
|
745
|
-
return wait();
|
|
746
|
-
case 54:
|
|
747
|
-
expect(instance.get('date')).have.lengthOf(2);
|
|
748
|
-
case 55:
|
|
749
1082
|
case "end":
|
|
750
|
-
return
|
|
1083
|
+
return _context30.stop();
|
|
751
1084
|
}
|
|
752
|
-
},
|
|
1085
|
+
}, _callee30);
|
|
753
1086
|
})));
|
|
754
|
-
|
|
755
|
-
var
|
|
756
|
-
return _regeneratorRuntime.wrap(function
|
|
757
|
-
while (1) switch (
|
|
1087
|
+
describe('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40() {
|
|
1088
|
+
var instance, element, datetime, dateString, match, show, _show4;
|
|
1089
|
+
return _regeneratorRuntime.wrap(function _callee40$(_context40) {
|
|
1090
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
758
1091
|
case 0:
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1092
|
+
_show4 = function _show6() {
|
|
1093
|
+
_show4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39() {
|
|
1094
|
+
var content, first;
|
|
1095
|
+
return _regeneratorRuntime.wrap(function _callee39$(_context39) {
|
|
1096
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1097
|
+
case 0:
|
|
1098
|
+
datetime.click();
|
|
1099
|
+
_context39.next = 3;
|
|
1100
|
+
return wait();
|
|
1101
|
+
case 3:
|
|
1102
|
+
content = getElement('.k-datepicker-content');
|
|
1103
|
+
first = content.querySelector('.k-calendar-item:not(.k-exceed)');
|
|
1104
|
+
first.click();
|
|
1105
|
+
_context39.next = 8;
|
|
1106
|
+
return wait();
|
|
1107
|
+
case 8:
|
|
1108
|
+
return _context39.abrupt("return", [content, first]);
|
|
1109
|
+
case 9:
|
|
1110
|
+
case "end":
|
|
1111
|
+
return _context39.stop();
|
|
1112
|
+
}
|
|
1113
|
+
}, _callee39);
|
|
1114
|
+
}));
|
|
1115
|
+
return _show4.apply(this, arguments);
|
|
1116
|
+
};
|
|
1117
|
+
show = function _show5() {
|
|
1118
|
+
return _show4.apply(this, arguments);
|
|
1119
|
+
};
|
|
1120
|
+
match = function _match(value, time) {
|
|
1121
|
+
expect(value).to.eql(dateString + " " + time);
|
|
1122
|
+
};
|
|
1123
|
+
dateString = dayjs(now).date(1).format('YYYY-MM-DD');
|
|
1124
|
+
beforeEach(function () {
|
|
1125
|
+
var result = mount(RangeDemo);
|
|
1126
|
+
instance = result[0];
|
|
1127
|
+
element = result[1];
|
|
1128
|
+
datetime = element.querySelectorAll('.k-datepicker')[1];
|
|
1129
|
+
});
|
|
1130
|
+
it('basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
|
|
1131
|
+
var _yield$show, content, first, confirm, inputInner, second, endDateString;
|
|
1132
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
1133
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1134
|
+
case 0:
|
|
1135
|
+
_context31.next = 2;
|
|
1136
|
+
return show();
|
|
1137
|
+
case 2:
|
|
1138
|
+
_yield$show = _context31.sent;
|
|
1139
|
+
content = _yield$show[0];
|
|
1140
|
+
first = _yield$show[1];
|
|
1141
|
+
// should enable confirm button and show the first date string in input
|
|
1142
|
+
confirm = content.querySelector('.k-datepicker-footer .k-btn');
|
|
1143
|
+
inputInner = datetime.querySelector('.k-input-inner');
|
|
1144
|
+
expect(confirm.classList.contains('k-disabled')).to.be.false;
|
|
1145
|
+
match(inputInner.getAttribute('placeholder'), '00:00:00 ~');
|
|
1146
|
+
match(inputInner.value, '00:00:00 ~');
|
|
1147
|
+
expect(instance.get('time')).eql(null);
|
|
1148
|
+
// select time
|
|
1149
|
+
dispatchEvent(content.querySelector('.k-scroll-select-item'), 'click');
|
|
1150
|
+
_context31.next = 14;
|
|
1151
|
+
return wait();
|
|
1152
|
+
case 14:
|
|
1153
|
+
match(inputInner.getAttribute('placeholder'), '15:00:00 ~');
|
|
1154
|
+
match(inputInner.value, '15:00:00 ~');
|
|
1155
|
+
confirm.click();
|
|
1156
|
+
_context31.next = 19;
|
|
1157
|
+
return wait();
|
|
1158
|
+
case 19:
|
|
1159
|
+
// should disable confirm button on first click
|
|
1160
|
+
expect(confirm.classList.contains('k-disabled')).to.be.true;
|
|
1161
|
+
// select the second datetime
|
|
1162
|
+
second = first.nextElementSibling;
|
|
1163
|
+
second.click();
|
|
1164
|
+
_context31.next = 24;
|
|
1165
|
+
return wait();
|
|
1166
|
+
case 24:
|
|
1167
|
+
endDateString = dayjs(now).date(2).format('YYYY-MM-DD');
|
|
1168
|
+
expect(inputInner.getAttribute('placeholder')).eql(dateString + " 15:00:00 ~ " + endDateString + " 00:00:00");
|
|
1169
|
+
expect(inputInner.value).eql(dateString + " 15:00:00 ~ " + endDateString + " 00:00:00");
|
|
1170
|
+
expect(instance.get('time')).eql(null);
|
|
1171
|
+
confirm.click();
|
|
1172
|
+
_context31.next = 31;
|
|
1173
|
+
return wait();
|
|
1174
|
+
case 31:
|
|
1175
|
+
expect(instance.get('time')).eql([dateString + " 15:00:00", endDateString + " 00:00:00"]);
|
|
1176
|
+
case 32:
|
|
1177
|
+
case "end":
|
|
1178
|
+
return _context31.stop();
|
|
1179
|
+
}
|
|
1180
|
+
}, _callee31);
|
|
1181
|
+
})));
|
|
1182
|
+
it('skip select date and select time for the end value directly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32() {
|
|
1183
|
+
var _yield$show2, content, confirm;
|
|
1184
|
+
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
1185
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1186
|
+
case 0:
|
|
1187
|
+
_context32.next = 2;
|
|
1188
|
+
return show();
|
|
1189
|
+
case 2:
|
|
1190
|
+
_yield$show2 = _context32.sent;
|
|
1191
|
+
content = _yield$show2[0];
|
|
1192
|
+
_context32.next = 6;
|
|
1193
|
+
return clickConfirm(content);
|
|
1194
|
+
case 6:
|
|
1195
|
+
confirm = _context32.sent;
|
|
1196
|
+
// select time
|
|
1197
|
+
dispatchEvent(content.querySelector('.k-scroll-select-item'), 'click');
|
|
1198
|
+
_context32.next = 10;
|
|
1199
|
+
return wait();
|
|
1200
|
+
case 10:
|
|
1201
|
+
confirm.click();
|
|
1202
|
+
_context32.next = 13;
|
|
1203
|
+
return wait();
|
|
1204
|
+
case 13:
|
|
1205
|
+
expect(instance.get('time')).eql([dateString + " 00:00:00", dateString + " 15:00:00"]);
|
|
1206
|
+
case 14:
|
|
1207
|
+
case "end":
|
|
1208
|
+
return _context32.stop();
|
|
1209
|
+
}
|
|
1210
|
+
}, _callee32);
|
|
1211
|
+
})));
|
|
1212
|
+
it('can change date before click confirm button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33() {
|
|
1213
|
+
var _yield$show3, content, first, nextFirst, inputInner, dateString, confirm, second;
|
|
1214
|
+
return _regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
1215
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1216
|
+
case 0:
|
|
1217
|
+
_context33.next = 2;
|
|
1218
|
+
return show();
|
|
1219
|
+
case 2:
|
|
1220
|
+
_yield$show3 = _context33.sent;
|
|
1221
|
+
content = _yield$show3[0];
|
|
1222
|
+
first = _yield$show3[1];
|
|
1223
|
+
nextFirst = first.nextElementSibling;
|
|
1224
|
+
nextFirst.click();
|
|
1225
|
+
_context33.next = 9;
|
|
1226
|
+
return wait();
|
|
1227
|
+
case 9:
|
|
1228
|
+
inputInner = datetime.querySelector('.k-input-inner');
|
|
1229
|
+
dateString = dayjs(now).date(2).format('YYYY-MM-DD');
|
|
1230
|
+
expect(inputInner.value).to.eql(dateString + " 00:00:00 ~");
|
|
1231
|
+
_context33.next = 14;
|
|
1232
|
+
return clickConfirm(content);
|
|
1233
|
+
case 14:
|
|
1234
|
+
confirm = _context33.sent;
|
|
1235
|
+
second = nextFirst.nextElementSibling;
|
|
1236
|
+
second.click();
|
|
1237
|
+
_context33.next = 19;
|
|
1238
|
+
return wait();
|
|
1239
|
+
case 19:
|
|
1240
|
+
expect(inputInner.value).to.eql(dateString + " 00:00:00 ~ " + getDateString(3) + " 00:00:00");
|
|
1241
|
+
second.nextElementSibling.click();
|
|
1242
|
+
_context33.next = 23;
|
|
1243
|
+
return wait();
|
|
1244
|
+
case 23:
|
|
1245
|
+
expect(inputInner.value).to.eql(dateString + " 00:00:00 ~ " + getDateString(4) + " 00:00:00");
|
|
1246
|
+
confirm.click();
|
|
1247
|
+
_context33.next = 27;
|
|
1248
|
+
return wait();
|
|
1249
|
+
case 27:
|
|
1250
|
+
expect(inputInner.value).to.eql(dateString + " 00:00:00 ~ " + getDateString(4) + " 00:00:00");
|
|
1251
|
+
expect(instance.get('time')).to.eql([dateString + " 00:00:00", getDateString(4) + " 00:00:00"]);
|
|
1252
|
+
case 29:
|
|
1253
|
+
case "end":
|
|
1254
|
+
return _context33.stop();
|
|
1255
|
+
}
|
|
1256
|
+
}, _callee33);
|
|
1257
|
+
})));
|
|
1258
|
+
it('can select end date which is less than start date on selecting', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34() {
|
|
1259
|
+
var _yield$show4, content, first, nextFirst, inputInner, confirm, a, b;
|
|
1260
|
+
return _regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
1261
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1262
|
+
case 0:
|
|
1263
|
+
_context34.next = 2;
|
|
1264
|
+
return show();
|
|
1265
|
+
case 2:
|
|
1266
|
+
_yield$show4 = _context34.sent;
|
|
1267
|
+
content = _yield$show4[0];
|
|
1268
|
+
first = _yield$show4[1];
|
|
1269
|
+
nextFirst = first.nextElementSibling;
|
|
1270
|
+
nextFirst.click();
|
|
1271
|
+
_context34.next = 9;
|
|
1272
|
+
return wait();
|
|
1273
|
+
case 9:
|
|
1274
|
+
inputInner = datetime.querySelector('.k-input-inner');
|
|
1275
|
+
expect(inputInner.value).to.eql(getDateString(2) + " 00:00:00 ~");
|
|
1276
|
+
// hide to reset the selected state
|
|
1277
|
+
document.body.click();
|
|
1278
|
+
_context34.next = 14;
|
|
1279
|
+
return wait();
|
|
1280
|
+
case 14:
|
|
1281
|
+
expect(inputInner.value).to.eql("");
|
|
1282
|
+
expect(instance.get('time')).to.be.null;
|
|
1283
|
+
// show again
|
|
1284
|
+
datetime.click();
|
|
1285
|
+
_context34.next = 19;
|
|
1286
|
+
return wait();
|
|
1287
|
+
case 19:
|
|
1288
|
+
nextFirst.click();
|
|
1289
|
+
_context34.next = 22;
|
|
1290
|
+
return wait();
|
|
1291
|
+
case 22:
|
|
1292
|
+
_context34.next = 24;
|
|
1293
|
+
return clickConfirm(content);
|
|
1294
|
+
case 24:
|
|
1295
|
+
confirm = _context34.sent;
|
|
1296
|
+
first.click();
|
|
1297
|
+
_context34.next = 28;
|
|
1298
|
+
return wait();
|
|
1299
|
+
case 28:
|
|
1300
|
+
a = getDateString(2) + " 00:00:00";
|
|
1301
|
+
b = getDateString(1) + " 00:00:00";
|
|
1302
|
+
expect(inputInner.value).to.eql(a + " ~ " + b);
|
|
1303
|
+
expect(instance.get('time')).to.eql(null);
|
|
1304
|
+
confirm.click();
|
|
1305
|
+
_context34.next = 35;
|
|
1306
|
+
return wait();
|
|
1307
|
+
case 35:
|
|
1308
|
+
expect(instance.get('time')).to.eql([b, a]);
|
|
1309
|
+
case 36:
|
|
1310
|
+
case "end":
|
|
1311
|
+
return _context34.stop();
|
|
1312
|
+
}
|
|
1313
|
+
}, _callee34);
|
|
1314
|
+
})));
|
|
1315
|
+
it('should reset position on clear value or set value to empty', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36() {
|
|
1316
|
+
var a, b, _yield$show5, content, first, selectAgain, _selectAgain;
|
|
1317
|
+
return _regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
1318
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1319
|
+
case 0:
|
|
1320
|
+
_selectAgain = function _selectAgain3() {
|
|
1321
|
+
_selectAgain = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35() {
|
|
1322
|
+
var confirm;
|
|
1323
|
+
return _regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
1324
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1325
|
+
case 0:
|
|
1326
|
+
_context35.next = 2;
|
|
1327
|
+
return wait();
|
|
1328
|
+
case 2:
|
|
1329
|
+
first.click();
|
|
1330
|
+
_context35.next = 5;
|
|
1331
|
+
return wait();
|
|
1332
|
+
case 5:
|
|
1333
|
+
_context35.next = 7;
|
|
1334
|
+
return clickConfirm(content);
|
|
1335
|
+
case 7:
|
|
1336
|
+
confirm = _context35.sent;
|
|
1337
|
+
first.nextElementSibling.click();
|
|
1338
|
+
_context35.next = 11;
|
|
1339
|
+
return wait();
|
|
1340
|
+
case 11:
|
|
1341
|
+
confirm.click();
|
|
1342
|
+
_context35.next = 14;
|
|
1343
|
+
return wait();
|
|
1344
|
+
case 14:
|
|
1345
|
+
expect(instance.get('time')).eql([a, b]);
|
|
1346
|
+
case 15:
|
|
1347
|
+
case "end":
|
|
1348
|
+
return _context35.stop();
|
|
1349
|
+
}
|
|
1350
|
+
}, _callee35);
|
|
1351
|
+
}));
|
|
1352
|
+
return _selectAgain.apply(this, arguments);
|
|
1353
|
+
};
|
|
1354
|
+
selectAgain = function _selectAgain2() {
|
|
1355
|
+
return _selectAgain.apply(this, arguments);
|
|
1356
|
+
};
|
|
1357
|
+
a = getDateString(1) + " 00:00:00";
|
|
1358
|
+
b = getDateString(2) + " 00:00:00";
|
|
1359
|
+
instance.set('time', [a, b]);
|
|
1360
|
+
_context36.next = 7;
|
|
1361
|
+
return show();
|
|
1362
|
+
case 7:
|
|
1363
|
+
_yield$show5 = _context36.sent;
|
|
1364
|
+
content = _yield$show5[0];
|
|
1365
|
+
first = _yield$show5[1];
|
|
1366
|
+
// clear
|
|
1367
|
+
dispatchEvent(datetime.querySelector('.k-select-clear'), 'click');
|
|
1368
|
+
_context36.next = 13;
|
|
1369
|
+
return wait();
|
|
1370
|
+
case 13:
|
|
1371
|
+
expect(instance.get('time')).eql(null);
|
|
1372
|
+
_context36.next = 16;
|
|
1373
|
+
return selectAgain();
|
|
1374
|
+
case 16:
|
|
1375
|
+
// set time to null
|
|
1376
|
+
datetime.click();
|
|
1377
|
+
_context36.next = 19;
|
|
1378
|
+
return wait();
|
|
1379
|
+
case 19:
|
|
1380
|
+
instance.set('time', null);
|
|
1381
|
+
_context36.next = 22;
|
|
1382
|
+
return selectAgain();
|
|
1383
|
+
case 22:
|
|
1384
|
+
// set time to empty array
|
|
1385
|
+
datetime.click();
|
|
1386
|
+
_context36.next = 25;
|
|
1387
|
+
return wait();
|
|
1388
|
+
case 25:
|
|
1389
|
+
instance.set('time', []);
|
|
1390
|
+
_context36.next = 28;
|
|
1391
|
+
return selectAgain();
|
|
1392
|
+
case 28:
|
|
1393
|
+
case "end":
|
|
1394
|
+
return _context36.stop();
|
|
1395
|
+
}
|
|
1396
|
+
}, _callee36);
|
|
1397
|
+
})));
|
|
1398
|
+
it('should only auto hide after twice selection and the start and end datetime are already selected', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38() {
|
|
1399
|
+
var _yield$show6, content, first, next, confirm, startDate, endDate, inputInner, separatePos, newFirst, _checkDisplay, setCursor, resetAndShow, _resetAndShow;
|
|
1400
|
+
return _regeneratorRuntime.wrap(function _callee38$(_context38) {
|
|
1401
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1402
|
+
case 0:
|
|
1403
|
+
_resetAndShow = function _resetAndShow3() {
|
|
1404
|
+
_resetAndShow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37() {
|
|
1405
|
+
return _regeneratorRuntime.wrap(function _callee37$(_context37) {
|
|
1406
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1407
|
+
case 0:
|
|
1408
|
+
instance.set('time', [startDate, endDate]);
|
|
1409
|
+
_context37.next = 3;
|
|
1410
|
+
return wait();
|
|
1411
|
+
case 3:
|
|
1412
|
+
setCursor(separatePos + 1);
|
|
1413
|
+
datetime.click();
|
|
1414
|
+
_context37.next = 7;
|
|
1415
|
+
return wait();
|
|
1416
|
+
case 7:
|
|
1417
|
+
case "end":
|
|
1418
|
+
return _context37.stop();
|
|
1419
|
+
}
|
|
1420
|
+
}, _callee37);
|
|
1421
|
+
}));
|
|
1422
|
+
return _resetAndShow.apply(this, arguments);
|
|
1423
|
+
};
|
|
1424
|
+
resetAndShow = function _resetAndShow2() {
|
|
1425
|
+
return _resetAndShow.apply(this, arguments);
|
|
1426
|
+
};
|
|
1427
|
+
setCursor = function _setCursor(pos) {
|
|
1428
|
+
inputInner.focus();
|
|
1429
|
+
inputInner.setSelectionRange(pos, pos);
|
|
1430
|
+
};
|
|
1431
|
+
_checkDisplay = function _checkDisplay2(isShow) {
|
|
1432
|
+
checkDisplay(content, isShow);
|
|
1433
|
+
};
|
|
1434
|
+
_context38.next = 6;
|
|
1435
|
+
return show();
|
|
1436
|
+
case 6:
|
|
1437
|
+
_yield$show6 = _context38.sent;
|
|
1438
|
+
content = _yield$show6[0];
|
|
1439
|
+
first = _yield$show6[1];
|
|
1440
|
+
next = first.nextElementSibling;
|
|
1441
|
+
next.click();
|
|
1442
|
+
_context38.next = 13;
|
|
1443
|
+
return wait();
|
|
1444
|
+
case 13:
|
|
1445
|
+
_context38.next = 15;
|
|
1446
|
+
return clickConfirm(content);
|
|
1447
|
+
case 15:
|
|
1448
|
+
confirm = _context38.sent;
|
|
1449
|
+
_context38.next = 18;
|
|
1450
|
+
return wait();
|
|
1451
|
+
case 18:
|
|
1452
|
+
_checkDisplay(true);
|
|
1453
|
+
first.click();
|
|
1454
|
+
_context38.next = 22;
|
|
1455
|
+
return wait();
|
|
1456
|
+
case 22:
|
|
1457
|
+
confirm.click();
|
|
1458
|
+
_context38.next = 25;
|
|
1459
|
+
return wait();
|
|
1460
|
+
case 25:
|
|
1461
|
+
_checkDisplay(false);
|
|
1462
|
+
startDate = '2025-08-07 00:00:00';
|
|
1463
|
+
endDate = '2025-08-10 00:00:00';
|
|
1464
|
+
inputInner = datetime.querySelector('.k-input-inner');
|
|
1465
|
+
separatePos = (dateString + " 00:00:00 ~").length;
|
|
1466
|
+
_context38.next = 32;
|
|
1467
|
+
return resetAndShow();
|
|
1468
|
+
case 32:
|
|
1469
|
+
newFirst = content.querySelector('.k-calendar-item:not(.k-exceed)');
|
|
1470
|
+
newFirst.click();
|
|
1471
|
+
_context38.next = 36;
|
|
1472
|
+
return wait();
|
|
1473
|
+
case 36:
|
|
1474
|
+
confirm.click();
|
|
1475
|
+
_context38.next = 39;
|
|
1476
|
+
return wait();
|
|
1477
|
+
case 39:
|
|
1478
|
+
_checkDisplay(true);
|
|
1479
|
+
expect(instance.get('time')).eql([startDate, endDate]);
|
|
1480
|
+
// cancel the start time selection
|
|
1481
|
+
document.body.click();
|
|
1482
|
+
_context38.next = 44;
|
|
1483
|
+
return wait();
|
|
1484
|
+
case 44:
|
|
1485
|
+
expect(instance.get('time')).eql(['2025-08-01 00:00:00', startDate]);
|
|
1486
|
+
// select from end position to start position
|
|
1487
|
+
_context38.next = 47;
|
|
1488
|
+
return resetAndShow();
|
|
1489
|
+
case 47:
|
|
1490
|
+
newFirst.click();
|
|
1491
|
+
_context38.next = 50;
|
|
1492
|
+
return wait();
|
|
1493
|
+
case 50:
|
|
1494
|
+
confirm.click();
|
|
1495
|
+
_context38.next = 53;
|
|
1496
|
+
return wait();
|
|
1497
|
+
case 53:
|
|
1498
|
+
newFirst.nextElementSibling.click();
|
|
1499
|
+
_context38.next = 56;
|
|
1500
|
+
return wait();
|
|
1501
|
+
case 56:
|
|
1502
|
+
_checkDisplay(true);
|
|
1503
|
+
expect(instance.get('time')).eql([startDate, endDate]);
|
|
1504
|
+
confirm.click();
|
|
1505
|
+
_context38.next = 61;
|
|
1506
|
+
return wait();
|
|
1507
|
+
case 61:
|
|
1508
|
+
_checkDisplay(false);
|
|
1509
|
+
expect(instance.get('time')).eql(['2025-08-01 00:00:00', '2025-08-02 00:00:00']);
|
|
1510
|
+
// select the end position value then change to end position again
|
|
1511
|
+
_context38.next = 65;
|
|
1512
|
+
return resetAndShow();
|
|
1513
|
+
case 65:
|
|
1514
|
+
newFirst.click();
|
|
1515
|
+
_context38.next = 68;
|
|
1516
|
+
return wait();
|
|
1517
|
+
case 68:
|
|
1518
|
+
confirm.click();
|
|
1519
|
+
_context38.next = 71;
|
|
1520
|
+
return wait();
|
|
1521
|
+
case 71:
|
|
1522
|
+
// change to the end position
|
|
1523
|
+
setCursor(separatePos + 1);
|
|
1524
|
+
datetime.click();
|
|
1525
|
+
newFirst.nextElementSibling.click();
|
|
1526
|
+
_context38.next = 76;
|
|
1527
|
+
return wait();
|
|
1528
|
+
case 76:
|
|
1529
|
+
_checkDisplay(true);
|
|
1530
|
+
confirm.click();
|
|
1531
|
+
// should not hide
|
|
1532
|
+
_context38.next = 80;
|
|
1533
|
+
return wait();
|
|
1534
|
+
case 80:
|
|
1535
|
+
_checkDisplay(true);
|
|
1536
|
+
// select the start position value
|
|
1537
|
+
newFirst.click();
|
|
1538
|
+
_context38.next = 84;
|
|
1539
|
+
return wait();
|
|
1540
|
+
case 84:
|
|
1541
|
+
confirm.click();
|
|
1542
|
+
_context38.next = 87;
|
|
1543
|
+
return wait();
|
|
1544
|
+
case 87:
|
|
1545
|
+
_checkDisplay(false);
|
|
1546
|
+
expect(instance.get('time')).eql(['2025-08-01 00:00:00', '2025-08-02 00:00:00']);
|
|
1547
|
+
case 89:
|
|
1548
|
+
case "end":
|
|
1549
|
+
return _context38.stop();
|
|
1550
|
+
}
|
|
1551
|
+
}, _callee38);
|
|
1552
|
+
})));
|
|
1553
|
+
case 11:
|
|
814
1554
|
case "end":
|
|
815
|
-
return
|
|
1555
|
+
return _context40.stop();
|
|
816
1556
|
}
|
|
817
|
-
},
|
|
1557
|
+
}, _callee40);
|
|
818
1558
|
})));
|
|
819
|
-
it('year', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
820
|
-
var _mount20, instance, element, _element$
|
|
821
|
-
return _regeneratorRuntime.wrap(function
|
|
822
|
-
while (1) switch (
|
|
1559
|
+
it('year', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
|
|
1560
|
+
var _mount20, instance, element, _element$querySelecto12, select, content, _content$querySelecto9, calendar1, calendar2, first, second, value;
|
|
1561
|
+
return _regeneratorRuntime.wrap(function _callee41$(_context41) {
|
|
1562
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
823
1563
|
case 0:
|
|
824
1564
|
_mount20 = mount(RangeDemo), instance = _mount20[0], element = _mount20[1];
|
|
825
|
-
_element$
|
|
1565
|
+
_element$querySelecto12 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto12[2];
|
|
826
1566
|
select.click();
|
|
827
|
-
|
|
1567
|
+
_context41.next = 5;
|
|
828
1568
|
return wait();
|
|
829
1569
|
case 5:
|
|
830
1570
|
content = getElement('.k-datepicker-content');
|
|
831
|
-
_content$
|
|
1571
|
+
_content$querySelecto9 = content.querySelectorAll('.k-datepicker-calendar-time-wrapper'), calendar1 = _content$querySelecto9[0], calendar2 = _content$querySelecto9[1];
|
|
832
1572
|
first = calendar1.querySelector('.k-calendar-item:nth-child(2)');
|
|
833
1573
|
second = calendar2.querySelector('.k-calendar-item:nth-child(2)');
|
|
834
1574
|
first.click();
|
|
835
1575
|
second.click();
|
|
836
|
-
|
|
1576
|
+
_context41.next = 13;
|
|
837
1577
|
return wait();
|
|
838
1578
|
case 13:
|
|
839
1579
|
value = instance.get('year');
|
|
840
1580
|
expect(value).eql([String(startYear), String(startYear + 10)]);
|
|
841
1581
|
case 15:
|
|
842
1582
|
case "end":
|
|
843
|
-
return
|
|
1583
|
+
return _context41.stop();
|
|
844
1584
|
}
|
|
845
|
-
},
|
|
1585
|
+
}, _callee41);
|
|
846
1586
|
})));
|
|
847
|
-
it('month', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
848
|
-
var _mount21, instance, element, _element$
|
|
849
|
-
return _regeneratorRuntime.wrap(function
|
|
850
|
-
while (1) switch (
|
|
1587
|
+
it('month', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {
|
|
1588
|
+
var _mount21, instance, element, _element$querySelecto13, select, content, _content$querySelecto10, calendar1, calendar2, first, second, value;
|
|
1589
|
+
return _regeneratorRuntime.wrap(function _callee42$(_context42) {
|
|
1590
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
851
1591
|
case 0:
|
|
852
1592
|
_mount21 = mount(RangeDemo), instance = _mount21[0], element = _mount21[1];
|
|
853
|
-
_element$
|
|
1593
|
+
_element$querySelecto13 = element.querySelectorAll('.k-datepicker'), select = _element$querySelecto13[3];
|
|
854
1594
|
select.click();
|
|
855
|
-
|
|
1595
|
+
_context42.next = 5;
|
|
856
1596
|
return wait();
|
|
857
1597
|
case 5:
|
|
858
1598
|
content = getElement('.k-datepicker-content');
|
|
859
|
-
_content$
|
|
1599
|
+
_content$querySelecto10 = content.querySelectorAll('.k-datepicker-calendar-time-wrapper'), calendar1 = _content$querySelecto10[0], calendar2 = _content$querySelecto10[1];
|
|
860
1600
|
first = calendar1.querySelector('.k-calendar-item:nth-child(1)');
|
|
861
1601
|
second = calendar2.querySelector('.k-calendar-item:nth-child(1)');
|
|
862
1602
|
first.click();
|
|
863
1603
|
second.click();
|
|
864
|
-
|
|
1604
|
+
_context42.next = 13;
|
|
865
1605
|
return wait();
|
|
866
1606
|
case 13:
|
|
867
1607
|
value = instance.get('month');
|
|
868
1608
|
expect(value).eql([year + "-01", year + 1 + "-01"]);
|
|
869
1609
|
case 15:
|
|
870
1610
|
case "end":
|
|
871
|
-
return
|
|
1611
|
+
return _context42.stop();
|
|
872
1612
|
}
|
|
873
|
-
},
|
|
1613
|
+
}, _callee42);
|
|
874
1614
|
})));
|
|
875
1615
|
});
|
|
876
1616
|
describe('Keybord', function () {
|
|
877
|
-
it('single date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
878
|
-
var
|
|
1617
|
+
it('single date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43() {
|
|
1618
|
+
var _context43;
|
|
879
1619
|
var _mount22, instance, element, now, select, content;
|
|
880
|
-
return _regeneratorRuntime.wrap(function
|
|
881
|
-
while (1) switch (
|
|
1620
|
+
return _regeneratorRuntime.wrap(function _callee43$(_context44) {
|
|
1621
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
882
1622
|
case 0:
|
|
883
1623
|
_mount22 = mount(BasicDemo), instance = _mount22[0], element = _mount22[1];
|
|
884
1624
|
now = new Date();
|
|
885
1625
|
select = element.querySelector('.k-datepicker');
|
|
886
1626
|
select.click();
|
|
887
|
-
|
|
1627
|
+
_context44.next = 6;
|
|
888
1628
|
return wait();
|
|
889
1629
|
case 6:
|
|
890
1630
|
content = getElement('.k-datepicker-content'); // down
|
|
891
1631
|
dispatchEvent(select, 'keydown', {
|
|
892
1632
|
keyCode: 40
|
|
893
1633
|
});
|
|
894
|
-
|
|
1634
|
+
_context44.next = 10;
|
|
895
1635
|
return wait();
|
|
896
1636
|
case 10:
|
|
897
1637
|
expect(+content.querySelector('.k-hover').textContent).to.eql(now.getDate());
|
|
@@ -899,7 +1639,7 @@ describe('Datepicker', function () {
|
|
|
899
1639
|
dispatchEvent(select, 'keydown', {
|
|
900
1640
|
keyCode: 38
|
|
901
1641
|
});
|
|
902
|
-
|
|
1642
|
+
_context44.next = 14;
|
|
903
1643
|
return wait();
|
|
904
1644
|
case 14:
|
|
905
1645
|
now.setDate(now.getDate() - 7);
|
|
@@ -908,7 +1648,7 @@ describe('Datepicker', function () {
|
|
|
908
1648
|
dispatchEvent(select, 'keydown', {
|
|
909
1649
|
keyCode: 39
|
|
910
1650
|
});
|
|
911
|
-
|
|
1651
|
+
_context44.next = 19;
|
|
912
1652
|
return wait();
|
|
913
1653
|
case 19:
|
|
914
1654
|
now.setDate(now.getDate() + 1);
|
|
@@ -917,7 +1657,7 @@ describe('Datepicker', function () {
|
|
|
917
1657
|
dispatchEvent(select, 'keydown', {
|
|
918
1658
|
keyCode: 37
|
|
919
1659
|
});
|
|
920
|
-
|
|
1660
|
+
_context44.next = 24;
|
|
921
1661
|
return wait();
|
|
922
1662
|
case 24:
|
|
923
1663
|
now.setDate(now.getDate() - 1);
|
|
@@ -926,39 +1666,39 @@ describe('Datepicker', function () {
|
|
|
926
1666
|
dispatchEvent(select, 'keydown', {
|
|
927
1667
|
keyCode: 13
|
|
928
1668
|
});
|
|
929
|
-
|
|
1669
|
+
_context44.next = 29;
|
|
930
1670
|
return wait();
|
|
931
1671
|
case 29:
|
|
932
|
-
expect(_mapInstanceProperty(
|
|
1672
|
+
expect(_mapInstanceProperty(_context43 = instance.get('date').split('-')).call(_context43, function (v) {
|
|
933
1673
|
return +v;
|
|
934
1674
|
})).to.eql([now.getFullYear(), now.getMonth() + 1, now.getDate()]);
|
|
935
1675
|
// again
|
|
936
1676
|
select.click();
|
|
937
|
-
|
|
1677
|
+
_context44.next = 33;
|
|
938
1678
|
return wait();
|
|
939
1679
|
case 33:
|
|
940
1680
|
dispatchEvent(select, 'keydown', {
|
|
941
1681
|
keyCode: 40
|
|
942
1682
|
});
|
|
943
|
-
|
|
1683
|
+
_context44.next = 36;
|
|
944
1684
|
return wait();
|
|
945
1685
|
case 36:
|
|
946
1686
|
expect(+content.querySelector('.k-hover').textContent).to.eql(now.getDate());
|
|
947
1687
|
case 37:
|
|
948
1688
|
case "end":
|
|
949
|
-
return
|
|
1689
|
+
return _context44.stop();
|
|
950
1690
|
}
|
|
951
|
-
},
|
|
1691
|
+
}, _callee43);
|
|
952
1692
|
})));
|
|
953
|
-
it('range date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1693
|
+
it('range date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44() {
|
|
954
1694
|
var _mount23, instance, element, select, value, _value;
|
|
955
|
-
return _regeneratorRuntime.wrap(function
|
|
956
|
-
while (1) switch (
|
|
1695
|
+
return _regeneratorRuntime.wrap(function _callee44$(_context45) {
|
|
1696
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
957
1697
|
case 0:
|
|
958
1698
|
_mount23 = mount(RangeDemo), instance = _mount23[0], element = _mount23[1];
|
|
959
1699
|
select = element.querySelector('.k-datepicker');
|
|
960
1700
|
select.click();
|
|
961
|
-
|
|
1701
|
+
_context45.next = 5;
|
|
962
1702
|
return wait();
|
|
963
1703
|
case 5:
|
|
964
1704
|
dispatchEvent(select, 'keydown', {
|
|
@@ -973,14 +1713,14 @@ describe('Datepicker', function () {
|
|
|
973
1713
|
dispatchEvent(select, 'keydown', {
|
|
974
1714
|
keyCode: 13
|
|
975
1715
|
});
|
|
976
|
-
|
|
1716
|
+
_context45.next = 11;
|
|
977
1717
|
return wait();
|
|
978
1718
|
case 11:
|
|
979
1719
|
value = instance.get('date');
|
|
980
1720
|
expect(value).have.lengthOf(2);
|
|
981
1721
|
// again
|
|
982
1722
|
select.click();
|
|
983
|
-
|
|
1723
|
+
_context45.next = 16;
|
|
984
1724
|
return wait();
|
|
985
1725
|
case 16:
|
|
986
1726
|
dispatchEvent(select, 'keydown', {
|
|
@@ -992,26 +1732,26 @@ describe('Datepicker', function () {
|
|
|
992
1732
|
dispatchEvent(select, 'keydown', {
|
|
993
1733
|
keyCode: 13
|
|
994
1734
|
});
|
|
995
|
-
|
|
1735
|
+
_context45.next = 21;
|
|
996
1736
|
return wait();
|
|
997
1737
|
case 21:
|
|
998
1738
|
_value = instance.get('date');
|
|
999
1739
|
expect(_value[0]).eql(_value[1]);
|
|
1000
1740
|
case 23:
|
|
1001
1741
|
case "end":
|
|
1002
|
-
return
|
|
1742
|
+
return _context45.stop();
|
|
1003
1743
|
}
|
|
1004
|
-
},
|
|
1744
|
+
}, _callee44);
|
|
1005
1745
|
})));
|
|
1006
1746
|
});
|
|
1007
|
-
describe('Event', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1008
|
-
return _regeneratorRuntime.wrap(function
|
|
1009
|
-
while (1) switch (
|
|
1747
|
+
describe('Event', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47() {
|
|
1748
|
+
return _regeneratorRuntime.wrap(function _callee47$(_context50) {
|
|
1749
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
1010
1750
|
case 0:
|
|
1011
|
-
it('selecting', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1751
|
+
it('selecting', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45() {
|
|
1012
1752
|
var fn, Demo, _mount24, instance, element, content, calendar, first, second, firstDateItem, activeTimeItem, nextTimeItem, confirmBtn, endCalendar, endFirst, endSecond, endDateItem, endActiveTimeItem, endNextTimeItem, finalConfirmBtn;
|
|
1013
|
-
return _regeneratorRuntime.wrap(function
|
|
1014
|
-
while (1) switch (
|
|
1753
|
+
return _regeneratorRuntime.wrap(function _callee45$(_context47) {
|
|
1754
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
1015
1755
|
case 0:
|
|
1016
1756
|
fn = sinon.spy(function (v) {
|
|
1017
1757
|
return console.log(v);
|
|
@@ -1019,12 +1759,12 @@ describe('Datepicker', function () {
|
|
|
1019
1759
|
Demo = /*#__PURE__*/function (_Component) {
|
|
1020
1760
|
_inheritsLoose(Demo, _Component);
|
|
1021
1761
|
function Demo() {
|
|
1022
|
-
var
|
|
1762
|
+
var _context46;
|
|
1023
1763
|
var _this;
|
|
1024
1764
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1025
1765
|
args[_key] = arguments[_key];
|
|
1026
1766
|
}
|
|
1027
|
-
_this = _Component.call.apply(_Component, _concatInstanceProperty(
|
|
1767
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context46 = [this]).call(_context46, args)) || this;
|
|
1028
1768
|
_this.Datepicker = Datepicker;
|
|
1029
1769
|
return _this;
|
|
1030
1770
|
}
|
|
@@ -1037,7 +1777,7 @@ describe('Datepicker', function () {
|
|
|
1037
1777
|
Demo.template = "\n const {Datepicker} = this;\n <Datepicker ev-selecting={this.onSelecting} range type=\"datetime\" />\n ";
|
|
1038
1778
|
_mount24 = mount(Demo), instance = _mount24[0], element = _mount24[1];
|
|
1039
1779
|
element.click();
|
|
1040
|
-
|
|
1780
|
+
_context47.next = 7;
|
|
1041
1781
|
return wait();
|
|
1042
1782
|
case 7:
|
|
1043
1783
|
content = getElement('.k-datepicker-content');
|
|
@@ -1055,7 +1795,7 @@ describe('Datepicker', function () {
|
|
|
1055
1795
|
expect(fn.lastCall.args[0]).have.lengthOf(1);
|
|
1056
1796
|
confirmBtn = content.querySelector('.k-datepicker-footer .k-btn');
|
|
1057
1797
|
confirmBtn.click();
|
|
1058
|
-
|
|
1798
|
+
_context47.next = 24;
|
|
1059
1799
|
return wait();
|
|
1060
1800
|
case 24:
|
|
1061
1801
|
endCalendar = content.querySelector('.k-datepicker-calendar-time-wrapper');
|
|
@@ -1072,108 +1812,161 @@ describe('Datepicker', function () {
|
|
|
1072
1812
|
expect(fn.lastCall.args[0]).have.lengthOf(1);
|
|
1073
1813
|
finalConfirmBtn = content.querySelector('.k-datepicker-footer .k-btn');
|
|
1074
1814
|
finalConfirmBtn.click();
|
|
1075
|
-
|
|
1815
|
+
_context47.next = 40;
|
|
1076
1816
|
return wait();
|
|
1077
1817
|
case 40:
|
|
1078
1818
|
expect(fn.callCount).to.eql(4);
|
|
1079
1819
|
case 41:
|
|
1080
1820
|
case "end":
|
|
1081
|
-
return
|
|
1821
|
+
return _context47.stop();
|
|
1822
|
+
}
|
|
1823
|
+
}, _callee45);
|
|
1824
|
+
})));
|
|
1825
|
+
it('should trigger change event once', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46() {
|
|
1826
|
+
var change, Demo, _mount25, instance, element, input, calendar, _calendar$querySelect, day1, day2;
|
|
1827
|
+
return _regeneratorRuntime.wrap(function _callee46$(_context49) {
|
|
1828
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
1829
|
+
case 0:
|
|
1830
|
+
change = sinon.spy(function () {
|
|
1831
|
+
return console.log('change');
|
|
1832
|
+
});
|
|
1833
|
+
Demo = /*#__PURE__*/function (_Component2) {
|
|
1834
|
+
_inheritsLoose(Demo, _Component2);
|
|
1835
|
+
function Demo() {
|
|
1836
|
+
var _context48;
|
|
1837
|
+
var _this2;
|
|
1838
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1839
|
+
args[_key2] = arguments[_key2];
|
|
1840
|
+
}
|
|
1841
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context48 = [this]).call(_context48, args)) || this;
|
|
1842
|
+
_this2.Datepicker = Datepicker;
|
|
1843
|
+
return _this2;
|
|
1844
|
+
}
|
|
1845
|
+
var _proto2 = Demo.prototype;
|
|
1846
|
+
_proto2.onChange = function onChange() {
|
|
1847
|
+
change();
|
|
1848
|
+
};
|
|
1849
|
+
return Demo;
|
|
1850
|
+
}(Component);
|
|
1851
|
+
Demo.template = "\n const {Datepicker} = this;\n <Datepicker range ev-$change:value={this.onChange} v-model=\"value\" clearable />\n ";
|
|
1852
|
+
_mount25 = mount(Demo), instance = _mount25[0], element = _mount25[1];
|
|
1853
|
+
input = element.querySelector('.k-input-inner');
|
|
1854
|
+
input.click();
|
|
1855
|
+
_context49.next = 8;
|
|
1856
|
+
return wait();
|
|
1857
|
+
case 8:
|
|
1858
|
+
calendar = getElement('.k-datepicker-content');
|
|
1859
|
+
_calendar$querySelect = calendar.querySelectorAll('.k-calendar-item:not(.k-exceed)'), day1 = _calendar$querySelect[0], day2 = _calendar$querySelect[1];
|
|
1860
|
+
day1.click();
|
|
1861
|
+
_context49.next = 13;
|
|
1862
|
+
return wait();
|
|
1863
|
+
case 13:
|
|
1864
|
+
day2.click();
|
|
1865
|
+
_context49.next = 16;
|
|
1866
|
+
return wait();
|
|
1867
|
+
case 16:
|
|
1868
|
+
expect(change.callCount).to.eql(1);
|
|
1869
|
+
case 17:
|
|
1870
|
+
case "end":
|
|
1871
|
+
return _context49.stop();
|
|
1082
1872
|
}
|
|
1083
|
-
},
|
|
1873
|
+
}, _callee46);
|
|
1084
1874
|
})));
|
|
1085
|
-
case
|
|
1875
|
+
case 2:
|
|
1086
1876
|
case "end":
|
|
1087
|
-
return
|
|
1877
|
+
return _context50.stop();
|
|
1088
1878
|
}
|
|
1089
|
-
},
|
|
1879
|
+
}, _callee47);
|
|
1090
1880
|
})));
|
|
1091
|
-
it('should disable some time pickers', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1092
|
-
var
|
|
1093
|
-
return _regeneratorRuntime.wrap(function
|
|
1094
|
-
while (1) switch (
|
|
1881
|
+
it('should disable some time pickers', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48() {
|
|
1882
|
+
var _mount26, instance, element, input, content;
|
|
1883
|
+
return _regeneratorRuntime.wrap(function _callee48$(_context51) {
|
|
1884
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
1095
1885
|
case 0:
|
|
1096
|
-
|
|
1886
|
+
_mount26 = mount(DatetimeDemo), instance = _mount26[0], element = _mount26[1];
|
|
1097
1887
|
input = element.querySelectorAll('.k-input')[1];
|
|
1098
1888
|
input.click();
|
|
1099
|
-
|
|
1889
|
+
_context51.next = 5;
|
|
1100
1890
|
return wait();
|
|
1101
1891
|
case 5:
|
|
1102
1892
|
content = getElement('.k-datepicker-content'); // change to time panel
|
|
1103
1893
|
content.querySelector('.k-calendar-item').click();
|
|
1104
|
-
|
|
1894
|
+
_context51.next = 9;
|
|
1105
1895
|
return wait();
|
|
1106
1896
|
case 9:
|
|
1107
1897
|
dispatchEvent(content.querySelector('.k-scroll-select:nth-child(3) .k-scroll-select-item'), 'click');
|
|
1108
1898
|
content.querySelector('.k-datepicker-footer .k-btn').click();
|
|
1899
|
+
_context51.next = 13;
|
|
1900
|
+
return wait();
|
|
1901
|
+
case 13:
|
|
1109
1902
|
expect(instance.get('datetime2').split(' ')[1]).eql('00:00');
|
|
1110
|
-
case
|
|
1903
|
+
case 14:
|
|
1111
1904
|
case "end":
|
|
1112
|
-
return
|
|
1905
|
+
return _context51.stop();
|
|
1113
1906
|
}
|
|
1114
|
-
},
|
|
1907
|
+
}, _callee48);
|
|
1115
1908
|
})));
|
|
1116
|
-
it('format', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1117
|
-
var
|
|
1118
|
-
return _regeneratorRuntime.wrap(function
|
|
1119
|
-
while (1) switch (
|
|
1909
|
+
it('format', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49() {
|
|
1910
|
+
var _mount27, instance, element, _element$querySelecto14, input1, input2, input3, content;
|
|
1911
|
+
return _regeneratorRuntime.wrap(function _callee49$(_context52) {
|
|
1912
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
1120
1913
|
case 0:
|
|
1121
|
-
|
|
1122
|
-
_element$
|
|
1914
|
+
_mount27 = mount(FormatDemo), instance = _mount27[0], element = _mount27[1];
|
|
1915
|
+
_element$querySelecto14 = element.querySelectorAll('.k-input-inner'), input1 = _element$querySelecto14[0], input2 = _element$querySelecto14[1], input3 = _element$querySelecto14[2];
|
|
1123
1916
|
input1.click();
|
|
1124
|
-
|
|
1917
|
+
_context52.next = 5;
|
|
1125
1918
|
return wait();
|
|
1126
1919
|
case 5:
|
|
1127
1920
|
content = getElement('.k-datepicker-content');
|
|
1128
1921
|
content.querySelector('.k-today').click();
|
|
1129
|
-
|
|
1922
|
+
_context52.next = 9;
|
|
1130
1923
|
return wait();
|
|
1131
1924
|
case 9:
|
|
1132
1925
|
expect(instance.get('date1')).to.eql(dayjs().format('MM/DD/YYYY'));
|
|
1133
1926
|
expect(input1.value).to.eql(dayjs().format('MM/DD/YYYY'));
|
|
1134
1927
|
input2.click();
|
|
1135
|
-
|
|
1928
|
+
_context52.next = 14;
|
|
1136
1929
|
return wait();
|
|
1137
1930
|
case 14:
|
|
1138
1931
|
content = getElement('.k-datepicker-content');
|
|
1139
1932
|
content.querySelector('.k-today').click();
|
|
1140
|
-
|
|
1933
|
+
_context52.next = 18;
|
|
1141
1934
|
return wait();
|
|
1142
1935
|
case 18:
|
|
1143
1936
|
expect(instance.get('date2')).to.eql(dayjs().format('YYYY-MM-DD'));
|
|
1144
1937
|
expect(input2.value).to.eql(dayjs().format('YYYY年M月D日'));
|
|
1145
1938
|
input3.click();
|
|
1146
|
-
|
|
1939
|
+
_context52.next = 23;
|
|
1147
1940
|
return wait();
|
|
1148
1941
|
case 23:
|
|
1149
1942
|
content = getElement('.k-datepicker-content');
|
|
1150
1943
|
content.querySelector('.k-today').click();
|
|
1151
|
-
|
|
1944
|
+
_context52.next = 27;
|
|
1152
1945
|
return wait();
|
|
1153
1946
|
case 27:
|
|
1154
1947
|
content.querySelector('.k-datepicker-footer .k-btn').click();
|
|
1155
|
-
|
|
1948
|
+
_context52.next = 30;
|
|
1156
1949
|
return wait();
|
|
1157
1950
|
case 30:
|
|
1158
1951
|
expect(instance.get('date3')).to.eql(dayjs().format('YYYY-MM-DD') + 'T00:00:00.000Z');
|
|
1159
1952
|
expect(input3.value).to.eql(dayjs().format('YYYY-MM-DD') + ' 00:00:00');
|
|
1160
1953
|
case 32:
|
|
1161
1954
|
case "end":
|
|
1162
|
-
return
|
|
1955
|
+
return _context52.stop();
|
|
1163
1956
|
}
|
|
1164
|
-
},
|
|
1957
|
+
}, _callee49);
|
|
1165
1958
|
})));
|
|
1166
1959
|
describe('Max / Min', function () {
|
|
1167
|
-
it('date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1168
|
-
var
|
|
1169
|
-
return _regeneratorRuntime.wrap(function
|
|
1170
|
-
while (1) switch (
|
|
1960
|
+
it('date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50() {
|
|
1961
|
+
var _mount28, instance, element, now, content, dateDoms;
|
|
1962
|
+
return _regeneratorRuntime.wrap(function _callee50$(_context53) {
|
|
1963
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
1171
1964
|
case 0:
|
|
1172
|
-
|
|
1965
|
+
_mount28 = mount(MaxMinDemo), instance = _mount28[0], element = _mount28[1];
|
|
1173
1966
|
now = dayjs().format('YYYY-MM-DD');
|
|
1174
1967
|
instance.set('to', now);
|
|
1175
1968
|
element.querySelector('.k-datepicker').click();
|
|
1176
|
-
|
|
1969
|
+
_context53.next = 6;
|
|
1177
1970
|
return wait();
|
|
1178
1971
|
case 6:
|
|
1179
1972
|
content = getElement('.k-datepicker-content');
|
|
@@ -1182,240 +1975,240 @@ describe('Datepicker', function () {
|
|
|
1182
1975
|
expect(+dateDoms[0].textContent).to.eql(+now.split('-')[2]);
|
|
1183
1976
|
case 10:
|
|
1184
1977
|
case "end":
|
|
1185
|
-
return
|
|
1978
|
+
return _context53.stop();
|
|
1186
1979
|
}
|
|
1187
|
-
},
|
|
1980
|
+
}, _callee50);
|
|
1188
1981
|
})));
|
|
1189
|
-
it('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1190
|
-
var
|
|
1191
|
-
return _regeneratorRuntime.wrap(function
|
|
1192
|
-
while (1) switch (
|
|
1982
|
+
it('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51() {
|
|
1983
|
+
var _mount29, instance, element, now, content;
|
|
1984
|
+
return _regeneratorRuntime.wrap(function _callee51$(_context54) {
|
|
1985
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
1193
1986
|
case 0:
|
|
1194
|
-
|
|
1987
|
+
_mount29 = mount(MaxMinDemo), instance = _mount29[0], element = _mount29[1];
|
|
1195
1988
|
now = dayjs().format('YYYY-MM-DD') + '00:00:00';
|
|
1196
1989
|
instance.set('toTime', now);
|
|
1197
1990
|
element.querySelectorAll('.k-datepicker')[2].click();
|
|
1198
|
-
|
|
1991
|
+
_context54.next = 6;
|
|
1199
1992
|
return wait();
|
|
1200
1993
|
case 6:
|
|
1201
1994
|
content = getElement('.k-datepicker-content');
|
|
1202
1995
|
content.querySelector('.k-today').click();
|
|
1203
|
-
|
|
1996
|
+
_context54.next = 10;
|
|
1204
1997
|
return wait();
|
|
1205
1998
|
case 10:
|
|
1206
1999
|
expect(content.querySelectorAll('.k-scroll-select-item:not(.k-disabled)')).have.lengthOf(3);
|
|
1207
2000
|
case 11:
|
|
1208
2001
|
case "end":
|
|
1209
|
-
return
|
|
2002
|
+
return _context54.stop();
|
|
1210
2003
|
}
|
|
1211
|
-
},
|
|
2004
|
+
}, _callee51);
|
|
1212
2005
|
})));
|
|
1213
|
-
it('should auto place scrollSeelct to the time that equal to the minDate after selecting the date in datetime picker', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1214
|
-
var
|
|
1215
|
-
return _regeneratorRuntime.wrap(function
|
|
1216
|
-
while (1) switch (
|
|
2006
|
+
it('should auto place scrollSeelct to the time that equal to the minDate after selecting the date in datetime picker', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52() {
|
|
2007
|
+
var _mount30, instance, element, date, time, fromTime, endTimeTrigger, content;
|
|
2008
|
+
return _regeneratorRuntime.wrap(function _callee52$(_context55) {
|
|
2009
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
1217
2010
|
case 0:
|
|
1218
|
-
|
|
2011
|
+
_mount30 = mount(MaxMinDemo), instance = _mount30[0], element = _mount30[1];
|
|
1219
2012
|
date = dayjs().format('YYYY-MM-DD');
|
|
1220
2013
|
time = '01:00:00';
|
|
1221
2014
|
fromTime = date + " " + time;
|
|
1222
2015
|
instance.set('fromTime', fromTime);
|
|
1223
2016
|
endTimeTrigger = element.querySelectorAll('.k-datepicker')[3];
|
|
1224
2017
|
endTimeTrigger.click();
|
|
1225
|
-
|
|
2018
|
+
_context55.next = 9;
|
|
1226
2019
|
return wait();
|
|
1227
2020
|
case 9:
|
|
1228
2021
|
content = getElement('.k-datepicker-content');
|
|
1229
2022
|
content.querySelector('.k-today').click();
|
|
1230
|
-
|
|
2023
|
+
_context55.next = 13;
|
|
1231
2024
|
return wait();
|
|
1232
2025
|
case 13:
|
|
1233
2026
|
content.querySelector('.k-datepicker-footer .k-btn').click();
|
|
1234
|
-
|
|
2027
|
+
_context55.next = 16;
|
|
1235
2028
|
return wait();
|
|
1236
2029
|
case 16:
|
|
1237
2030
|
expect(instance.get('toTime')).to.eql(date + " " + time);
|
|
1238
2031
|
case 17:
|
|
1239
2032
|
case "end":
|
|
1240
|
-
return
|
|
2033
|
+
return _context55.stop();
|
|
1241
2034
|
}
|
|
1242
|
-
},
|
|
2035
|
+
}, _callee52);
|
|
1243
2036
|
})));
|
|
1244
2037
|
});
|
|
1245
2038
|
describe('Input', function () {
|
|
1246
2039
|
var globalInput;
|
|
1247
2040
|
function test(template) {
|
|
1248
|
-
var Demo = /*#__PURE__*/function (
|
|
1249
|
-
_inheritsLoose(Demo,
|
|
2041
|
+
var Demo = /*#__PURE__*/function (_Component3) {
|
|
2042
|
+
_inheritsLoose(Demo, _Component3);
|
|
1250
2043
|
function Demo() {
|
|
1251
|
-
var
|
|
1252
|
-
var
|
|
1253
|
-
for (var
|
|
1254
|
-
args[
|
|
2044
|
+
var _context56;
|
|
2045
|
+
var _this3;
|
|
2046
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
2047
|
+
args[_key3] = arguments[_key3];
|
|
1255
2048
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
return
|
|
2049
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context56 = [this]).call(_context56, args)) || this;
|
|
2050
|
+
_this3.Datepicker = Datepicker;
|
|
2051
|
+
return _this3;
|
|
1259
2052
|
}
|
|
1260
2053
|
return Demo;
|
|
1261
2054
|
}(Component);
|
|
1262
2055
|
Demo.template = "\n const {Datepicker} = this;\n " + template + "\n ";
|
|
1263
|
-
var
|
|
1264
|
-
instance =
|
|
1265
|
-
element =
|
|
2056
|
+
var _mount31 = mount(Demo),
|
|
2057
|
+
instance = _mount31[0],
|
|
2058
|
+
element = _mount31[1];
|
|
1266
2059
|
var input = element.querySelector('.k-input-inner');
|
|
1267
2060
|
globalInput = input;
|
|
1268
2061
|
return /*#__PURE__*/function () {
|
|
1269
|
-
var
|
|
1270
|
-
return _regeneratorRuntime.wrap(function
|
|
1271
|
-
while (1) switch (
|
|
2062
|
+
var _ref49 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(value, result) {
|
|
2063
|
+
return _regeneratorRuntime.wrap(function _callee53$(_context57) {
|
|
2064
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
1272
2065
|
case 0:
|
|
1273
2066
|
input.value = value;
|
|
1274
2067
|
dispatchEvent(input, 'input');
|
|
1275
|
-
|
|
2068
|
+
_context57.next = 4;
|
|
1276
2069
|
return wait();
|
|
1277
2070
|
case 4:
|
|
1278
2071
|
expect(instance.get('value')).to.eql(result);
|
|
1279
2072
|
case 5:
|
|
1280
2073
|
case "end":
|
|
1281
|
-
return
|
|
2074
|
+
return _context57.stop();
|
|
1282
2075
|
}
|
|
1283
|
-
},
|
|
2076
|
+
}, _callee53);
|
|
1284
2077
|
}));
|
|
1285
|
-
return function (
|
|
1286
|
-
return
|
|
2078
|
+
return function (_x2, _x3) {
|
|
2079
|
+
return _ref49.apply(this, arguments);
|
|
1287
2080
|
};
|
|
1288
2081
|
}();
|
|
1289
2082
|
}
|
|
1290
|
-
it('basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2083
|
+
it('basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54() {
|
|
1291
2084
|
var myTest;
|
|
1292
|
-
return _regeneratorRuntime.wrap(function
|
|
1293
|
-
while (1) switch (
|
|
2085
|
+
return _regeneratorRuntime.wrap(function _callee54$(_context58) {
|
|
2086
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
1294
2087
|
case 0:
|
|
1295
2088
|
myTest = test("<Datepicker v-model=\"value\" max=\"2021-11-11\" min=\"2020-01-01\" />"); // input incorrect value
|
|
1296
|
-
|
|
2089
|
+
_context58.next = 3;
|
|
1297
2090
|
return myTest('2020', undefined);
|
|
1298
2091
|
case 3:
|
|
1299
|
-
|
|
2092
|
+
_context58.next = 5;
|
|
1300
2093
|
return myTest('2020-02-02', '2020-02-02');
|
|
1301
2094
|
case 5:
|
|
1302
|
-
|
|
2095
|
+
_context58.next = 7;
|
|
1303
2096
|
return myTest('', null);
|
|
1304
2097
|
case 7:
|
|
1305
|
-
|
|
2098
|
+
_context58.next = 9;
|
|
1306
2099
|
return myTest('1999-01-01', null);
|
|
1307
2100
|
case 9:
|
|
1308
2101
|
case "end":
|
|
1309
|
-
return
|
|
2102
|
+
return _context58.stop();
|
|
1310
2103
|
}
|
|
1311
|
-
},
|
|
2104
|
+
}, _callee54);
|
|
1312
2105
|
})));
|
|
1313
|
-
it('multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2106
|
+
it('multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55() {
|
|
1314
2107
|
var myTest;
|
|
1315
|
-
return _regeneratorRuntime.wrap(function
|
|
1316
|
-
while (1) switch (
|
|
2108
|
+
return _regeneratorRuntime.wrap(function _callee55$(_context59) {
|
|
2109
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
1317
2110
|
case 0:
|
|
1318
2111
|
myTest = test("<Datepicker v-model=\"value\" multiple />"); // input incorrect value
|
|
1319
|
-
|
|
2112
|
+
_context59.next = 3;
|
|
1320
2113
|
return myTest('2', undefined);
|
|
1321
2114
|
case 3:
|
|
1322
|
-
|
|
2115
|
+
_context59.next = 5;
|
|
1323
2116
|
return myTest('2020-02-02', ['2020-02-02']);
|
|
1324
2117
|
case 5:
|
|
1325
|
-
|
|
2118
|
+
_context59.next = 7;
|
|
1326
2119
|
return myTest('2', ['2020-02-02']);
|
|
1327
2120
|
case 7:
|
|
1328
|
-
|
|
2121
|
+
_context59.next = 9;
|
|
1329
2122
|
return myTest('2020-03-03', ['2020-02-02', '2020-03-03']);
|
|
1330
2123
|
case 9:
|
|
1331
2124
|
case "end":
|
|
1332
|
-
return
|
|
2125
|
+
return _context59.stop();
|
|
1333
2126
|
}
|
|
1334
|
-
},
|
|
2127
|
+
}, _callee55);
|
|
1335
2128
|
})));
|
|
1336
|
-
it('range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2129
|
+
it('range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56() {
|
|
1337
2130
|
var myTest;
|
|
1338
|
-
return _regeneratorRuntime.wrap(function
|
|
1339
|
-
while (1) switch (
|
|
2131
|
+
return _regeneratorRuntime.wrap(function _callee56$(_context60) {
|
|
2132
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
1340
2133
|
case 0:
|
|
1341
2134
|
myTest = test("<Datepicker v-model=\"value\" range max=\"2021-11-11\" min=\"2020-01-01\" />");
|
|
1342
|
-
|
|
2135
|
+
_context60.next = 3;
|
|
1343
2136
|
return myTest('2020-03-03', undefined);
|
|
1344
2137
|
case 3:
|
|
1345
|
-
|
|
2138
|
+
_context60.next = 5;
|
|
1346
2139
|
return myTest('2020-03-03~', undefined);
|
|
1347
2140
|
case 5:
|
|
1348
2141
|
// input correct value
|
|
1349
2142
|
dispatchEvent(globalInput, 'click'); // show calendar
|
|
1350
|
-
|
|
2143
|
+
_context60.next = 8;
|
|
1351
2144
|
return wait();
|
|
1352
2145
|
case 8:
|
|
1353
|
-
|
|
2146
|
+
_context60.next = 10;
|
|
1354
2147
|
return myTest('2020-03-03~2020-03-04', ['2020-03-03', '2020-03-04']);
|
|
1355
2148
|
case 10:
|
|
1356
2149
|
expect(getElement('.k-datepicker-content').querySelector('.k-datepicker-calendar-time-wrapper:nth-child(1)').innerHTML).to.matchSnapshot();
|
|
1357
2150
|
// clear value
|
|
1358
|
-
|
|
2151
|
+
_context60.next = 13;
|
|
1359
2152
|
return myTest('', null);
|
|
1360
2153
|
case 13:
|
|
1361
|
-
|
|
2154
|
+
_context60.next = 15;
|
|
1362
2155
|
return myTest('1999-01-01~2020-03-04', null);
|
|
1363
2156
|
case 15:
|
|
1364
2157
|
case "end":
|
|
1365
|
-
return
|
|
2158
|
+
return _context60.stop();
|
|
1366
2159
|
}
|
|
1367
|
-
},
|
|
2160
|
+
}, _callee56);
|
|
1368
2161
|
})));
|
|
1369
|
-
it('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2162
|
+
it('datetime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57() {
|
|
1370
2163
|
var myTest;
|
|
1371
|
-
return _regeneratorRuntime.wrap(function
|
|
1372
|
-
while (1) switch (
|
|
2164
|
+
return _regeneratorRuntime.wrap(function _callee57$(_context61) {
|
|
2165
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
1373
2166
|
case 0:
|
|
1374
2167
|
myTest = test("<Datepicker v-model=\"value\" type=\"datetime\" />");
|
|
1375
|
-
|
|
2168
|
+
_context61.next = 3;
|
|
1376
2169
|
return myTest('2020-03-03', undefined);
|
|
1377
2170
|
case 3:
|
|
1378
|
-
|
|
2171
|
+
_context61.next = 5;
|
|
1379
2172
|
return myTest('2020-03-03 02:02:02', '2020-03-03 02:02:02');
|
|
1380
2173
|
case 5:
|
|
1381
2174
|
case "end":
|
|
1382
|
-
return
|
|
2175
|
+
return _context61.stop();
|
|
1383
2176
|
}
|
|
1384
|
-
},
|
|
2177
|
+
}, _callee57);
|
|
1385
2178
|
})));
|
|
1386
|
-
it('datetime range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2179
|
+
it('datetime range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58() {
|
|
1387
2180
|
var myTest;
|
|
1388
|
-
return _regeneratorRuntime.wrap(function
|
|
1389
|
-
while (1) switch (
|
|
2181
|
+
return _regeneratorRuntime.wrap(function _callee58$(_context62) {
|
|
2182
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
1390
2183
|
case 0:
|
|
1391
2184
|
myTest = test('<Datepicker v-model="value" type="datetime" range />');
|
|
1392
|
-
|
|
2185
|
+
_context62.next = 3;
|
|
1393
2186
|
return myTest('2020-08-11 00:00:00 ~ 2020-08-11 01:00:00', ['2020-08-11 00:00:00', '2020-08-11 01:00:00']);
|
|
1394
2187
|
case 3:
|
|
1395
|
-
|
|
2188
|
+
_context62.next = 5;
|
|
1396
2189
|
return myTest('2020-08-11 00:01:00 ~ 2020-08-11 01:00:00', ['2020-08-11 00:01:00', '2020-08-11 01:00:00']);
|
|
1397
2190
|
case 5:
|
|
1398
|
-
|
|
2191
|
+
_context62.next = 7;
|
|
1399
2192
|
return myTest('2020-08-11 00:01:00 ~ 2020-08-11 01:01:00', ['2020-08-11 00:01:00', '2020-08-11 01:01:00']);
|
|
1400
2193
|
case 7:
|
|
1401
2194
|
case "end":
|
|
1402
|
-
return
|
|
2195
|
+
return _context62.stop();
|
|
1403
2196
|
}
|
|
1404
|
-
},
|
|
2197
|
+
}, _callee58);
|
|
1405
2198
|
})));
|
|
1406
|
-
it('date format', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2199
|
+
it('date format', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59() {
|
|
1407
2200
|
var myTest;
|
|
1408
|
-
return _regeneratorRuntime.wrap(function
|
|
1409
|
-
while (1) switch (
|
|
2201
|
+
return _regeneratorRuntime.wrap(function _callee59$(_context63) {
|
|
2202
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
1410
2203
|
case 0:
|
|
1411
2204
|
myTest = test("<Datepicker v-model=\"value\" showFormat=\"YYYY\u5E74M\u6708D\u65E5\" />");
|
|
1412
|
-
|
|
2205
|
+
_context63.next = 3;
|
|
1413
2206
|
return myTest('2020年2月19日', '2020-02-19');
|
|
1414
2207
|
case 3:
|
|
1415
2208
|
case "end":
|
|
1416
|
-
return
|
|
2209
|
+
return _context63.stop();
|
|
1417
2210
|
}
|
|
1418
|
-
},
|
|
2211
|
+
}, _callee59);
|
|
1419
2212
|
})));
|
|
1420
2213
|
});
|
|
1421
2214
|
});
|