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