@king-design/react 3.5.2 → 3.6.0

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