@king-design/intact 3.6.0-beta.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/components/button/demos/basic.md +0 -1
  2. package/components/cascader/index.spec.ts +7 -6
  3. package/components/copy/index.spec.ts +9 -14
  4. package/components/datepicker/basepicker.ts +26 -314
  5. package/components/datepicker/calendar.ts +3 -1
  6. package/components/datepicker/calendar.vdt +5 -2
  7. package/components/datepicker/dayjs.ts +2 -16
  8. package/components/datepicker/demos/multiple.md +5 -0
  9. package/components/datepicker/demos/yearMonth.md +2 -8
  10. package/components/datepicker/helpers.ts +5 -7
  11. package/components/datepicker/index.md +1 -2
  12. package/components/datepicker/index.spec.ts +596 -157
  13. package/components/datepicker/index.ts +16 -33
  14. package/components/datepicker/index.vdt +41 -35
  15. package/components/datepicker/shortcuts.ts +1 -1
  16. package/components/datepicker/styles.ts +27 -18
  17. package/components/datepicker/useConfirm.ts +82 -0
  18. package/components/datepicker/useDisabled.ts +29 -31
  19. package/components/datepicker/useFormats.ts +8 -4
  20. package/components/datepicker/useHighlight.ts +81 -0
  21. package/components/datepicker/useKeyboards.ts +2 -1
  22. package/components/datepicker/useMergeRange.ts +12 -12
  23. package/components/datepicker/useMonths.ts +6 -3
  24. package/components/datepicker/usePanel.ts +19 -19
  25. package/components/datepicker/useShowDate.ts +21 -41
  26. package/components/datepicker/useStatus.ts +34 -15
  27. package/components/datepicker/useValue.ts +43 -72
  28. package/components/datepicker/useValueBase.ts +312 -0
  29. package/components/datepicker/useWeeks.ts +1 -1
  30. package/components/datepicker/useYears.ts +7 -3
  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/form/form.ts +4 -0
  36. package/components/form/index.md +2 -1
  37. package/components/form/index.spec.ts +2 -0
  38. package/components/input/index.spec.ts +42 -0
  39. package/components/input/index.ts +8 -0
  40. package/components/input/index.vdt +3 -4
  41. package/components/input/useAutoWidth.ts +19 -1
  42. package/components/menu/demos/horizontal.md +7 -1
  43. package/components/menu/index.spec.ts +19 -0
  44. package/components/menu/styles.ts +2 -1
  45. package/components/scrollSelect/useMouseEvents.ts +5 -4
  46. package/components/select/base.ts +3 -2
  47. package/components/select/base.vdt +2 -1
  48. package/components/select/demos/creatable.md +2 -2
  49. package/components/select/index.md +1 -1
  50. package/components/select/index.spec.ts +142 -36
  51. package/components/select/menu.ts +1 -1
  52. package/components/select/option.ts +2 -1
  53. package/components/select/select.ts +1 -0
  54. package/components/select/styles.ts +3 -1
  55. package/components/select/useCard.ts +22 -4
  56. package/components/select/useInput.ts +5 -9
  57. package/components/spinner/index.spec.ts +18 -0
  58. package/components/spinner/useValue.ts +2 -1
  59. package/components/table/index.spec.ts +69 -1
  60. package/components/table/useStickyHeader.ts +1 -1
  61. package/components/timepicker/index.spec.ts +145 -27
  62. package/components/timepicker/panelPicker.ts +10 -4
  63. package/components/timepicker/panelPicker.vdt +3 -5
  64. package/components/timepicker/styles.ts +1 -0
  65. package/components/timepicker/useConfirm.ts +33 -0
  66. package/components/timepicker/useDefaultValue.ts +30 -0
  67. package/components/timepicker/useDisabled.ts +17 -4
  68. package/components/timepicker/useFormats.ts +1 -1
  69. package/components/timepicker/useValue.ts +22 -19
  70. package/components/tour/index.spec.ts +1 -1
  71. package/es/components/cascader/index.spec.js +18 -19
  72. package/es/components/copy/index.spec.js +14 -31
  73. package/es/components/datepicker/basepicker.d.ts +6 -27
  74. package/es/components/datepicker/basepicker.js +23 -268
  75. package/es/components/datepicker/calendar.d.ts +4 -2
  76. package/es/components/datepicker/dayjs.d.ts +2 -13
  77. package/es/components/datepicker/helpers.d.ts +3 -2
  78. package/es/components/datepicker/helpers.js +2 -3
  79. package/es/components/datepicker/index.d.ts +21 -29
  80. package/es/components/datepicker/index.js +22 -32
  81. package/es/components/datepicker/index.spec.js +1277 -484
  82. package/es/components/datepicker/index.vdt.js +39 -38
  83. package/es/components/datepicker/shortcuts.d.ts +1 -1
  84. package/es/components/datepicker/styles.d.ts +7 -2
  85. package/es/components/datepicker/styles.js +10 -15
  86. package/es/components/datepicker/useConfirm.d.ts +6 -0
  87. package/es/components/datepicker/useConfirm.js +65 -0
  88. package/es/components/datepicker/useDisabled.d.ts +5 -3
  89. package/es/components/datepicker/useDisabled.js +22 -27
  90. package/es/components/datepicker/useFormats.d.ts +2 -2
  91. package/es/components/datepicker/useFormats.js +6 -2
  92. package/es/components/datepicker/useHighlight.d.ts +14 -0
  93. package/es/components/datepicker/useHighlight.js +60 -0
  94. package/es/components/datepicker/useKeyboards.js +2 -1
  95. package/es/components/datepicker/useMergeRange.d.ts +1 -1
  96. package/es/components/datepicker/useMergeRange.js +11 -16
  97. package/es/components/datepicker/useMonths.js +5 -3
  98. package/es/components/datepicker/usePanel.d.ts +1 -10
  99. package/es/components/datepicker/usePanel.js +19 -32
  100. package/es/components/datepicker/useShowDate.d.ts +1 -1
  101. package/es/components/datepicker/useShowDate.js +15 -40
  102. package/es/components/datepicker/useStatus.js +33 -16
  103. package/es/components/datepicker/useValue.d.ts +11 -6
  104. package/es/components/datepicker/useValue.js +49 -69
  105. package/es/components/datepicker/useValueBase.d.ts +28 -0
  106. package/es/components/datepicker/useValueBase.js +280 -0
  107. package/es/components/datepicker/useYears.js +6 -3
  108. package/es/components/dropdown/dropdown.d.ts +1 -0
  109. package/es/components/dropdown/dropdown.js +7 -4
  110. package/es/components/form/form.d.ts +1 -0
  111. package/es/components/form/form.js +7 -0
  112. package/es/components/form/index.spec.js +10 -8
  113. package/es/components/input/index.d.ts +2 -0
  114. package/es/components/input/index.js +6 -0
  115. package/es/components/input/index.spec.js +45 -0
  116. package/es/components/input/index.vdt.js +4 -3
  117. package/es/components/input/useAutoWidth.d.ts +2 -0
  118. package/es/components/input/useAutoWidth.js +19 -1
  119. package/es/components/menu/index.spec.js +28 -0
  120. package/es/components/menu/styles.js +2 -2
  121. package/es/components/scrollSelect/useMouseEvents.js +5 -4
  122. package/es/components/select/base.d.ts +1 -1
  123. package/es/components/select/base.js +3 -2
  124. package/es/components/select/base.vdt.js +4 -3
  125. package/es/components/select/index.spec.js +346 -218
  126. package/es/components/select/menu.js +1 -1
  127. package/es/components/select/option.js +2 -1
  128. package/es/components/select/select.js +2 -1
  129. package/es/components/select/styles.d.ts +79 -0
  130. package/es/components/select/styles.js +1 -0
  131. package/es/components/select/useCard.d.ts +4 -3
  132. package/es/components/select/useCard.js +15 -4
  133. package/es/components/select/useInput.d.ts +1 -1
  134. package/es/components/select/useInput.js +4 -4
  135. package/es/components/spinner/index.spec.js +82 -44
  136. package/es/components/spinner/useValue.js +2 -1
  137. package/es/components/table/index.spec.js +84 -6
  138. package/es/components/table/useStickyHeader.js +1 -1
  139. package/es/components/timepicker/index.spec.js +298 -128
  140. package/es/components/timepicker/panelPicker.d.ts +21 -16
  141. package/es/components/timepicker/panelPicker.js +7 -4
  142. package/es/components/timepicker/panelPicker.vdt.js +5 -9
  143. package/es/components/timepicker/selectPicker.d.ts +4 -3
  144. package/es/components/timepicker/styles.js +1 -1
  145. package/es/components/timepicker/useConfirm.d.ts +6 -0
  146. package/es/components/timepicker/useConfirm.js +19 -0
  147. package/es/components/timepicker/useDefaultValue.d.ts +4 -0
  148. package/es/components/timepicker/useDefaultValue.js +27 -0
  149. package/es/components/timepicker/useDisabled.d.ts +6 -3
  150. package/es/components/timepicker/useDisabled.js +13 -4
  151. package/es/components/timepicker/useFormats.d.ts +1 -1
  152. package/es/components/timepicker/useValue.d.ts +13 -8
  153. package/es/components/timepicker/useValue.js +14 -15
  154. package/es/components/tour/index.spec.js +1 -1
  155. package/es/index.d.ts +2 -2
  156. package/es/index.js +2 -2
  157. package/es/site/data/components/button/demos/basic/react.js +0 -2
  158. package/es/site/data/components/datepicker/demos/multiple/index.d.ts +1 -0
  159. package/es/site/data/components/datepicker/demos/multiple/index.js +2 -1
  160. package/es/site/data/components/datepicker/demos/multiple/react.d.ts +1 -0
  161. package/es/site/data/components/datepicker/demos/multiple/react.js +13 -2
  162. package/es/site/data/components/datepicker/demos/yearMonth/index.d.ts +0 -2
  163. package/es/site/data/components/datepicker/demos/yearMonth/index.js +1 -3
  164. package/es/site/data/components/datepicker/demos/yearMonth/react.d.ts +0 -2
  165. package/es/site/data/components/datepicker/demos/yearMonth/react.js +1 -21
  166. package/es/site/data/components/menu/demos/horizontal/react.js +5 -1
  167. package/es/site/data/components/select/demos/creatable/react.js +2 -2
  168. package/es/site/data/components/select/demos/searchable/index.js +1 -1
  169. package/es/site/data/components/select/demos/searchable/react.js +1 -1
  170. package/es/site/data/components/tour/demos/customText/index.d.ts +19 -6
  171. package/es/site/data/components/tour/demos/customText/index.js +18 -17
  172. package/es/site/data/components/tour/demos/customText/react.d.ts +20 -6
  173. package/es/site/data/components/tour/demos/customText/react.js +31 -27
  174. package/es/test/demos.js +1 -1
  175. package/index.ts +2 -2
  176. package/package.json +2 -2
  177. package/components/datepicker/demos/nowrap.md +0 -35
  178. package/components/datepicker/usePosition.ts +0 -169
  179. package/es/components/datepicker/usePosition.d.ts +0 -10
  180. package/es/components/datepicker/usePosition.js +0 -166
  181. package/es/site/data/components/datepicker/demos/nowrap/index.d.ts +0 -10
  182. package/es/site/data/components/datepicker/demos/nowrap/index.js +0 -19
  183. package/es/site/data/components/datepicker/demos/nowrap/react.d.ts +0 -10
  184. package/es/site/data/components/datepicker/demos/nowrap/react.js +0 -49
  185. package/es/site/data/components/tour/demos/customButtons/index.d.ts +0 -33
  186. package/es/site/data/components/tour/demos/customButtons/index.js +0 -55
  187. package/es/site/data/components/tour/demos/customButtons/react.d.ts +0 -33
  188. package/es/site/data/components/tour/demos/customButtons/react.js +0 -99
@@ -17,19 +17,28 @@ import { Select, Option } from '../select';
17
17
  import SearchableDemo from '~/components/select/demos/searchable';
18
18
  import ImmutableDemo from '~/components/select/demos/immutable';
19
19
  describe('Select', function () {
20
- afterEach(function (done) {
21
- unmount();
22
- setTimeout(done, 500);
23
- });
24
- it('should select value correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
25
- var _mount, instance, element, trigger, dropdown, item, _dropdown;
20
+ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26
21
  return _regeneratorRuntime.wrap(function _callee$(_context) {
27
22
  while (1) switch (_context.prev = _context.next) {
23
+ case 0:
24
+ unmount();
25
+ _context.next = 3;
26
+ return wait(500);
27
+ case 3:
28
+ case "end":
29
+ return _context.stop();
30
+ }
31
+ }, _callee);
32
+ })));
33
+ it('should select value correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
34
+ var _mount, instance, element, trigger, dropdown, item, _dropdown;
35
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
36
+ while (1) switch (_context2.prev = _context2.next) {
28
37
  case 0:
29
38
  _mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
30
39
  trigger = element.querySelector('.k-select');
31
40
  trigger.click();
32
- _context.next = 5;
41
+ _context2.next = 5;
33
42
  return wait();
34
43
  case 5:
35
44
  expect(element.outerHTML).to.matchSnapshot();
@@ -37,65 +46,65 @@ describe('Select', function () {
37
46
  expect(dropdown.innerHTML).to.matchSnapshot();
38
47
  item = dropdown.querySelector('.k-dropdown-item');
39
48
  item.click();
40
- _context.next = 12;
49
+ _context2.next = 12;
41
50
  return wait();
42
51
  case 12:
43
52
  expect(element.outerHTML).to.matchSnapshot();
44
53
  trigger.click();
45
- _context.next = 16;
54
+ _context2.next = 16;
46
55
  return wait();
47
56
  case 16:
48
57
  _dropdown = getElement('.k-select-menu');
49
58
  expect(_dropdown.innerHTML).to.matchSnapshot();
50
59
  case 18:
51
60
  case "end":
52
- return _context.stop();
61
+ return _context2.stop();
53
62
  }
54
- }, _callee);
63
+ }, _callee2);
55
64
  })));
56
- it('disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
65
+ it('disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
57
66
  var _mount2, instance, element, _element$querySelecto, trigger, dropdown, close;
58
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
59
- while (1) switch (_context2.prev = _context2.next) {
67
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
68
+ while (1) switch (_context3.prev = _context3.next) {
60
69
  case 0:
61
70
  _mount2 = mount(DisabledDemo), instance = _mount2[0], element = _mount2[1];
62
71
  _element$querySelecto = element.querySelectorAll('.k-select'), trigger = _element$querySelecto[1];
63
72
  trigger.click();
64
- _context2.next = 5;
73
+ _context3.next = 5;
65
74
  return wait();
66
75
  case 5:
67
76
  dropdown = getElement('.k-select-menu');
68
77
  expect(dropdown.innerHTML).to.matchSnapshot();
69
78
  close = element.querySelector('.k-tag-close');
70
79
  close.click();
71
- _context2.next = 11;
80
+ _context3.next = 11;
72
81
  return wait();
73
82
  case 11:
74
83
  expect(instance.get('days').length).to.eql(2);
75
84
  case 12:
76
85
  case "end":
77
- return _context2.stop();
86
+ return _context3.stop();
78
87
  }
79
- }, _callee2);
88
+ }, _callee3);
80
89
  })));
81
- it('clearable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
90
+ it('clearable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
82
91
  var _mount3, instance, element, _element$querySelecto2, clear1, clear2, Demo, _mount4, element1, clear;
83
- return _regeneratorRuntime.wrap(function _callee3$(_context4) {
84
- while (1) switch (_context4.prev = _context4.next) {
92
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
93
+ while (1) switch (_context5.prev = _context5.next) {
85
94
  case 0:
86
95
  _mount3 = mount(ClearableDemo), instance = _mount3[0], element = _mount3[1];
87
96
  instance.set({
88
97
  day: 'Monday',
89
98
  days: ['Monday', 'TuesdayT']
90
99
  });
91
- _context4.next = 4;
100
+ _context5.next = 4;
92
101
  return wait();
93
102
  case 4:
94
103
  expect(element.outerHTML).to.matchSnapshot();
95
104
  _element$querySelecto2 = element.querySelectorAll('.k-select-clear'), clear1 = _element$querySelecto2[0], clear2 = _element$querySelecto2[1];
96
105
  clear1.click();
97
106
  clear2.click();
98
- _context4.next = 10;
107
+ _context5.next = 10;
99
108
  return wait();
100
109
  case 10:
101
110
  expect(instance.get('day')).to.eql(null);
@@ -105,12 +114,12 @@ describe('Select', function () {
105
114
  Demo = /*#__PURE__*/function (_Component) {
106
115
  _inheritsLoose(Demo, _Component);
107
116
  function Demo() {
108
- var _context3;
117
+ var _context4;
109
118
  var _this;
110
119
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
111
120
  args[_key] = arguments[_key];
112
121
  }
113
- _this = _Component.call.apply(_Component, _concatInstanceProperty(_context3 = [this]).call(_context3, args)) || this;
122
+ _this = _Component.call.apply(_Component, _concatInstanceProperty(_context4 = [this]).call(_context4, args)) || this;
114
123
  _this.Select = Select;
115
124
  _this.Option = Option;
116
125
  return _this;
@@ -128,26 +137,26 @@ describe('Select', function () {
128
137
  expect(clear).to.be.null;
129
138
  case 18:
130
139
  case "end":
131
- return _context4.stop();
140
+ return _context5.stop();
132
141
  }
133
- }, _callee3);
142
+ }, _callee4);
134
143
  })));
135
- it('multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
144
+ it('multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
136
145
  var _mount5, instance, element, _element$querySelecto3, trigger, dropdown, _dropdown$querySelect, item1, item2, deleteBtn;
137
- return _regeneratorRuntime.wrap(function _callee4$(_context5) {
138
- while (1) switch (_context5.prev = _context5.next) {
146
+ return _regeneratorRuntime.wrap(function _callee5$(_context6) {
147
+ while (1) switch (_context6.prev = _context6.next) {
139
148
  case 0:
140
149
  _mount5 = mount(ClearableDemo), instance = _mount5[0], element = _mount5[1];
141
150
  _element$querySelecto3 = element.querySelectorAll('.k-select'), trigger = _element$querySelecto3[1];
142
151
  trigger.click();
143
- _context5.next = 5;
152
+ _context6.next = 5;
144
153
  return wait();
145
154
  case 5:
146
155
  dropdown = getElement('.k-select-menu');
147
156
  _dropdown$querySelect = dropdown.querySelectorAll('.k-dropdown-item'), item1 = _dropdown$querySelect[0], item2 = _dropdown$querySelect[1];
148
157
  item1.click();
149
158
  item2.click();
150
- _context5.next = 11;
159
+ _context6.next = 11;
151
160
  return wait();
152
161
  case 11:
153
162
  expect(dropdown.innerHTML).to.matchSnapshot();
@@ -155,31 +164,31 @@ describe('Select', function () {
155
164
  // delete
156
165
  deleteBtn = element.querySelector('.k-tag-close');
157
166
  deleteBtn.click();
158
- _context5.next = 17;
167
+ _context6.next = 17;
159
168
  return wait();
160
169
  case 17:
161
170
  expect(instance.get('days')).to.eql(['Tuesday']);
162
171
  expect(dropdown.innerHTML).to.matchSnapshot();
163
172
  case 19:
164
173
  case "end":
165
- return _context5.stop();
174
+ return _context6.stop();
166
175
  }
167
- }, _callee4);
176
+ }, _callee5);
168
177
  })));
169
- it('filterable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
178
+ it('filterable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
170
179
  var _mount6, instance, element, _element$querySelecto4, input1, input2, input3, dropdown1, dropdown2;
171
- return _regeneratorRuntime.wrap(function _callee5$(_context6) {
172
- while (1) switch (_context6.prev = _context6.next) {
180
+ return _regeneratorRuntime.wrap(function _callee6$(_context7) {
181
+ while (1) switch (_context7.prev = _context7.next) {
173
182
  case 0:
174
183
  _mount6 = mount(FilterDemo), instance = _mount6[0], element = _mount6[1];
175
184
  _element$querySelecto4 = element.querySelectorAll('.k-input-inner'), input1 = _element$querySelecto4[0], input2 = _element$querySelecto4[1], input3 = _element$querySelecto4[2];
176
185
  input1.click();
177
- _context6.next = 5;
186
+ _context7.next = 5;
178
187
  return wait();
179
188
  case 5:
180
189
  input1.value = 'm';
181
190
  dispatchEvent(input1, 'input');
182
- _context6.next = 9;
191
+ _context7.next = 9;
183
192
  return wait();
184
193
  case 9:
185
194
  dropdown1 = getElement('.k-select-menu');
@@ -187,17 +196,17 @@ describe('Select', function () {
187
196
  dispatchEvent(document, 'keydown', {
188
197
  keyCode: 13
189
198
  });
190
- _context6.next = 14;
199
+ _context7.next = 14;
191
200
  return wait();
192
201
  case 14:
193
202
  expect(instance.get('day')).to.eql('Monday');
194
203
  input2.click();
195
- _context6.next = 18;
204
+ _context7.next = 18;
196
205
  return wait();
197
206
  case 18:
198
207
  input2.value = '二';
199
208
  dispatchEvent(input2, 'input');
200
- _context6.next = 22;
209
+ _context7.next = 22;
201
210
  return wait();
202
211
  case 22:
203
212
  dropdown2 = getElement('.k-select-menu');
@@ -205,70 +214,70 @@ describe('Select', function () {
205
214
  dispatchEvent(document, 'keydown', {
206
215
  keyCode: 13
207
216
  });
208
- _context6.next = 27;
217
+ _context7.next = 27;
209
218
  return wait();
210
219
  case 27:
211
220
  input2.value = 'Wed';
212
221
  dispatchEvent(input2, 'input');
213
- _context6.next = 31;
222
+ _context7.next = 31;
214
223
  return wait();
215
224
  case 31:
216
225
  dispatchEvent(document, 'keydown', {
217
226
  keyCode: 13
218
227
  });
219
- _context6.next = 34;
228
+ _context7.next = 34;
220
229
  return wait();
221
230
  case 34:
222
231
  expect(instance.get('days')).to.eql(['Tuesday', 'Wednesday']);
223
232
  input3.click();
224
- _context6.next = 38;
233
+ _context7.next = 38;
225
234
  return wait();
226
235
  case 38:
227
236
  input3.value = 'm';
228
237
  dispatchEvent(input3, 'input');
229
- _context6.next = 42;
238
+ _context7.next = 42;
230
239
  return wait();
231
240
  case 42:
232
241
  expect(getElement('.k-select-menu').innerText).to.eql('无数据');
233
242
  input3.value = '三';
234
243
  dispatchEvent(input3, 'input');
235
- _context6.next = 47;
244
+ _context7.next = 47;
236
245
  return wait();
237
246
  case 47:
238
247
  dispatchEvent(document, 'keydown', {
239
248
  keyCode: 13
240
249
  });
241
- _context6.next = 50;
250
+ _context7.next = 50;
242
251
  return wait();
243
252
  case 50:
244
253
  expect(instance.get('day1')).to.eql('Wednesday');
245
254
  // should input spaces
246
255
  input1.click();
247
- _context6.next = 54;
256
+ _context7.next = 54;
248
257
  return wait();
249
258
  case 54:
250
259
  dispatchEvent(input1, 'focus');
251
260
  input1.value = 'm ';
252
261
  dispatchEvent(input1, 'input');
253
- _context6.next = 59;
262
+ _context7.next = 59;
254
263
  return wait();
255
264
  case 59:
256
265
  expect(input1.value).to.eql('m ');
257
266
  case 60:
258
267
  case "end":
259
- return _context6.stop();
268
+ return _context7.stop();
260
269
  }
261
- }, _callee5);
270
+ }, _callee6);
262
271
  })));
263
- it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
272
+ it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
264
273
  var _mount7, instance, element, _element$querySelecto5, trigger1, trigger2, dropdown1, item, dropdown2;
265
- return _regeneratorRuntime.wrap(function _callee6$(_context7) {
266
- while (1) switch (_context7.prev = _context7.next) {
274
+ return _regeneratorRuntime.wrap(function _callee7$(_context8) {
275
+ while (1) switch (_context8.prev = _context8.next) {
267
276
  case 0:
268
277
  _mount7 = mount(GroupDemo), instance = _mount7[0], element = _mount7[1];
269
278
  _element$querySelecto5 = element.querySelectorAll('.k-select'), trigger1 = _element$querySelecto5[0], trigger2 = _element$querySelecto5[1];
270
279
  trigger1.click();
271
- _context7.next = 5;
280
+ _context8.next = 5;
272
281
  return wait();
273
282
  case 5:
274
283
  dropdown1 = getElement('.k-select-menu');
@@ -277,28 +286,73 @@ describe('Select', function () {
277
286
  item.click();
278
287
  expect(instance.get('day')).to.eql('Monday');
279
288
  trigger2.click();
280
- _context7.next = 13;
289
+ _context8.next = 13;
281
290
  return wait();
282
291
  case 13:
283
292
  dropdown2 = getElement('.k-select-menu');
284
293
  expect(dropdown2.innerHTML).to.matchSnapshot();
285
294
  case 15:
286
295
  case "end":
287
- return _context7.stop();
296
+ return _context8.stop();
288
297
  }
289
- }, _callee6);
298
+ }, _callee7);
290
299
  })));
291
- it('keyboard operations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
292
- var _mount8, instance, element, select, dropdown;
293
- return _regeneratorRuntime.wrap(function _callee7$(_context8) {
294
- while (1) switch (_context8.prev = _context8.next) {
300
+ it('should select the first card of group on filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
301
+ var _mount8, instance, element, _element$querySelecto6, trigger, dropdown, input, firstTab, defaultStatusTest;
302
+ return _regeneratorRuntime.wrap(function _callee8$(_context9) {
303
+ while (1) switch (_context9.prev = _context9.next) {
295
304
  case 0:
296
- _mount8 = mount(BasicDemo), instance = _mount8[0], element = _mount8[1];
305
+ defaultStatusTest = function _defaultStatusTest() {
306
+ var secondTab = dropdown.querySelector('.k-tab:nth-child(2)');
307
+ var item = dropdown.querySelector('.k-dropdown-item');
308
+ expect(secondTab.classList.contains('k-active')).to.eql(true);
309
+ expect(item.classList.contains('k-active')).to.eql(true);
310
+ };
311
+ _mount8 = mount(GroupDemo), instance = _mount8[0], element = _mount8[1];
312
+ instance.set('day', 'Saturday');
313
+ _context9.next = 5;
314
+ return wait();
315
+ case 5:
316
+ _element$querySelecto6 = element.querySelectorAll('.k-select'), trigger = _element$querySelecto6[1];
317
+ trigger.click();
318
+ _context9.next = 9;
319
+ return wait();
320
+ case 9:
321
+ dropdown = getElement('.k-select-menu');
322
+ defaultStatusTest();
323
+ // filter
324
+ input = trigger.querySelector('.k-input-inner');
325
+ input.value = 'm';
326
+ dispatchEvent(input, 'input');
327
+ _context9.next = 16;
328
+ return wait();
329
+ case 16:
330
+ firstTab = dropdown.querySelector('.k-tab');
331
+ expect(firstTab.classList.contains('k-active')).to.eql(true);
332
+ // clear
333
+ input.value = '';
334
+ dispatchEvent(input, 'input');
335
+ _context9.next = 22;
336
+ return wait();
337
+ case 22:
338
+ defaultStatusTest();
339
+ case 23:
340
+ case "end":
341
+ return _context9.stop();
342
+ }
343
+ }, _callee8);
344
+ })));
345
+ it('keyboard operations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
346
+ var _mount9, instance, element, select, dropdown;
347
+ return _regeneratorRuntime.wrap(function _callee9$(_context10) {
348
+ while (1) switch (_context10.prev = _context10.next) {
349
+ case 0:
350
+ _mount9 = mount(BasicDemo), instance = _mount9[0], element = _mount9[1];
297
351
  select = element.querySelector('.k-select');
298
352
  dispatchEvent(select, 'keydown', {
299
353
  keyCode: 13
300
354
  });
301
- _context8.next = 5;
355
+ _context10.next = 5;
302
356
  return wait();
303
357
  case 5:
304
358
  dropdown = getElement('.k-select-menu');
@@ -306,85 +360,138 @@ describe('Select', function () {
306
360
  dispatchEvent(select, 'keydown', {
307
361
  keyCode: 9
308
362
  });
309
- _context8.next = 10;
363
+ _context10.next = 10;
310
364
  return wait(500);
311
365
  case 10:
312
366
  expect(dropdown.style.display).to.eql('none');
313
367
  case 11:
314
368
  case "end":
315
- return _context8.stop();
369
+ return _context10.stop();
316
370
  }
317
- }, _callee7);
371
+ }, _callee9);
318
372
  })));
319
- it('creatable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
320
- var _mount9, instance, element, input, dropdown;
321
- return _regeneratorRuntime.wrap(function _callee8$(_context9) {
322
- while (1) switch (_context9.prev = _context9.next) {
373
+ it('creatable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
374
+ var _mount10, instance, element, input, dropdown, createOption, newCreateOption, _element$querySelecto7, multipleInput, multipleDropdown, mondayOption;
375
+ return _regeneratorRuntime.wrap(function _callee10$(_context11) {
376
+ while (1) switch (_context11.prev = _context11.next) {
323
377
  case 0:
324
- _mount9 = mount(CreatableDemo), instance = _mount9[0], element = _mount9[1];
378
+ _mount10 = mount(CreatableDemo), instance = _mount10[0], element = _mount10[1];
325
379
  input = element.querySelector('.k-input-inner');
380
+ expect(instance.get('day')).to.be.null;
326
381
  input.click();
327
- _context9.next = 5;
382
+ _context11.next = 6;
328
383
  return wait();
329
- case 5:
384
+ case 6:
330
385
  input.value = 'xxx';
331
386
  dispatchEvent(input, 'input');
332
- _context9.next = 9;
387
+ _context11.next = 10;
333
388
  return wait();
334
- case 9:
389
+ case 10:
335
390
  dropdown = getElement('.k-select-menu');
336
391
  expect(dropdown.innerHTML).to.matchSnapshot();
337
- // select
392
+ // check the created option appears in dropdown
393
+ createOption = dropdown.querySelector('.k-select-option');
394
+ expect(createOption).to.exist;
395
+ expect(createOption.textContent).to.contain('xxx');
396
+ // press enter to select the custom option
338
397
  dispatchEvent(document, 'keydown', {
339
398
  keyCode: 13
340
399
  });
341
- _context9.next = 14;
400
+ _context11.next = 18;
342
401
  return wait();
343
- case 14:
402
+ case 18:
344
403
  expect(instance.get('day')).to.eql('xxx');
345
- // open again
404
+ expect(input.value).to.eql('xxx');
405
+ // reopen dropdown
346
406
  input.click();
347
- _context9.next = 18;
407
+ _context11.next = 23;
348
408
  return wait();
349
- case 18:
409
+ case 23:
350
410
  expect(element.innerHTML).to.matchSnapshot();
351
411
  expect(dropdown.innerHTML).to.matchSnapshot();
352
- // input again
412
+ // input another custom option
353
413
  input.value = 'yyy';
354
414
  dispatchEvent(input, 'input');
355
- _context9.next = 24;
415
+ _context11.next = 29;
356
416
  return wait();
357
- case 24:
417
+ case 29:
358
418
  expect(element.innerHTML).to.matchSnapshot();
359
419
  expect(dropdown.innerHTML).to.matchSnapshot();
360
- // discard
420
+ newCreateOption = dropdown.querySelector('.k-select-option');
421
+ expect(newCreateOption).to.exist;
422
+ expect(newCreateOption.textContent).to.contain('yyy');
423
+ // click outside to cancel selection
361
424
  dispatchEvent(document, 'click');
362
- _context9.next = 29;
425
+ _context11.next = 37;
363
426
  return wait();
364
- case 29:
427
+ case 37:
365
428
  expect(element.innerHTML).to.matchSnapshot();
366
- expect(instance.get('day')).to.eql('xxx');
367
- case 31:
429
+ expect(instance.get('day')).to.eql('xxx'); // should keep the original value
430
+ expect(input.value).to.eql('xxx'); // should restore the original value
431
+ // test multiple creatable
432
+ _element$querySelecto7 = element.querySelectorAll('.k-input-inner'), multipleInput = _element$querySelecto7[1];
433
+ expect(instance.get('days')).to.eql([]);
434
+ multipleInput.click();
435
+ _context11.next = 45;
436
+ return wait();
437
+ case 45:
438
+ multipleInput.value = 'custom1';
439
+ dispatchEvent(multipleInput, 'input');
440
+ _context11.next = 49;
441
+ return wait();
442
+ case 49:
443
+ // press enter to create and select the first custom option
444
+ dispatchEvent(document, 'keydown', {
445
+ keyCode: 13
446
+ });
447
+ _context11.next = 52;
448
+ return wait();
449
+ case 52:
450
+ expect(instance.get('days')).to.include('custom1');
451
+ expect(multipleInput.value).to.eql('custom1');
452
+ // input the same option again
453
+ dispatchEvent(document, 'keydown', {
454
+ keyCode: 13
455
+ });
456
+ _context11.next = 57;
457
+ return wait();
458
+ case 57:
459
+ expect(instance.get('days')).to.eql([]);
460
+ expect(multipleInput.value).to.eql('custom1');
461
+ // test select original options
462
+ multipleInput.value = 'Monday';
463
+ dispatchEvent(multipleInput, 'input');
464
+ _context11.next = 63;
465
+ return wait();
466
+ case 63:
467
+ multipleDropdown = getElement('.k-select-menu');
468
+ mondayOption = multipleDropdown.querySelector('.k-select-option');
469
+ expect(mondayOption.textContent).to.eql('星期一');
470
+ mondayOption.click();
471
+ _context11.next = 69;
472
+ return wait();
473
+ case 69:
474
+ expect(instance.get('days')).to.include('Monday');
475
+ case 70:
368
476
  case "end":
369
- return _context9.stop();
477
+ return _context11.stop();
370
478
  }
371
- }, _callee8);
479
+ }, _callee10);
372
480
  })));
373
- it('keepKeywords', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
374
- var KeepKeywordsDemo, _mount10, instance, element, input, dropdown, mondayOption;
375
- return _regeneratorRuntime.wrap(function _callee9$(_context11) {
376
- while (1) switch (_context11.prev = _context11.next) {
481
+ it('keepKeywords', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
482
+ var KeepKeywordsDemo, _mount11, instance, element, input, dropdown, mondayOption;
483
+ return _regeneratorRuntime.wrap(function _callee11$(_context13) {
484
+ while (1) switch (_context13.prev = _context13.next) {
377
485
  case 0:
378
- // 创建一个测试组件,包含keepKeywords功能
379
486
  KeepKeywordsDemo = /*#__PURE__*/function (_Component2) {
380
487
  _inheritsLoose(KeepKeywordsDemo, _Component2);
381
488
  function KeepKeywordsDemo() {
382
- var _context10;
489
+ var _context12;
383
490
  var _this2;
384
491
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
385
492
  args[_key2] = arguments[_key2];
386
493
  }
387
- _this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context10 = [this]).call(_context10, args)) || this;
494
+ _this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context12 = [this]).call(_context12, args)) || this;
388
495
  _this2.Select = Select;
389
496
  _this2.Option = Option;
390
497
  return _this2;
@@ -396,103 +503,103 @@ describe('Select', function () {
396
503
  };
397
504
  return KeepKeywordsDemo;
398
505
  }(Component);
399
- KeepKeywordsDemo.template = "\n const {Select, Option} = this;\n <div>\n <Select v-model=\"days\" filterable multiple creatable keepKeywords>\n <Option value=\"Monday\">\u661F\u671F\u4E00</Option>\n <Option value=\"Tuesday\">\u661F\u671F\u4E8C</Option>\n <Option value=\"Wednesday\">\u661F\u671F\u4E09</Option>\n </Select>\n </div>\n ";
400
- _mount10 = mount(KeepKeywordsDemo), instance = _mount10[0], element = _mount10[1];
401
- input = element.querySelector('.k-input-inner'); // 1. 输入自定义选项 "custom1"
506
+ KeepKeywordsDemo.template = "\n const {Select, Option} = this;\n <div>\n <Select v-model=\"days\" filterable multiple creatable keepKeywords={false}>\n <Option value=\"Monday\">\u661F\u671F\u4E00</Option>\n <Option value=\"Tuesday\">\u661F\u671F\u4E8C</Option>\n <Option value=\"Wednesday\">\u661F\u671F\u4E09</Option>\n </Select>\n </div>\n ";
507
+ _mount11 = mount(KeepKeywordsDemo), instance = _mount11[0], element = _mount11[1];
508
+ input = element.querySelector('.k-input-inner'); // input custom option "custom1"
402
509
  input.click();
403
- _context11.next = 7;
510
+ _context13.next = 7;
404
511
  return wait();
405
512
  case 7:
406
513
  input.value = 'custom1';
407
514
  dispatchEvent(input, 'input');
408
- _context11.next = 11;
515
+ _context13.next = 11;
409
516
  return wait();
410
517
  case 11:
411
- // 验证创建的选项出现在dropdown
518
+ // check the created option appears in dropdown
412
519
  dropdown = getElement('.k-select-menu');
413
520
  expect(dropdown.innerHTML).to.contain('custom1');
414
- // 2. 按回车创建并选中
521
+ // press enter to create and select
415
522
  dispatchEvent(document, 'keydown', {
416
523
  keyCode: 13
417
524
  });
418
- _context11.next = 16;
525
+ _context13.next = 16;
419
526
  return wait();
420
527
  case 16:
421
- // 验证选项被选中,且输入框被清空
528
+ // check the option is selected, and the input is cleared
422
529
  expect(instance.get('days')).to.eql(['custom1']);
423
- expect(input.value).to.eql(''); // keepKeywords=true时应该清空输入框
424
- // 3. 再次输入相同的选项 "custom1"
530
+ expect(input.value).to.eql('');
531
+ // input the same option "custom1" again
425
532
  input.value = 'custom1';
426
533
  dispatchEvent(input, 'input');
427
- _context11.next = 22;
534
+ _context13.next = 22;
428
535
  return wait();
429
536
  case 22:
430
- // 4. 再次按回车
537
+ // press enter again
431
538
  dispatchEvent(document, 'keydown', {
432
539
  keyCode: 13
433
540
  });
434
- _context11.next = 25;
541
+ _context13.next = 25;
435
542
  return wait();
436
543
  case 25:
437
- // 验证选项仍然被选中(不会被取消选中),且输入框被清空
438
- expect(instance.get('days')).to.eql(['custom1']); // 应该保持选中状态
439
- expect(input.value).to.eql(''); // 输入框应该被清空
440
- // 5. 输入另一个自定义选项 "custom2"
544
+ // check the option is still selected (not be unselected), and the input is cleared
545
+ expect(instance.get('days')).to.eql(['custom1']); // should be selected
546
+ expect(input.value).to.eql(''); // should be cleared
547
+ // input another custom option "custom2"
441
548
  input.value = 'custom2';
442
549
  dispatchEvent(input, 'input');
443
- _context11.next = 31;
550
+ _context13.next = 31;
444
551
  return wait();
445
552
  case 31:
446
553
  dispatchEvent(document, 'keydown', {
447
554
  keyCode: 13
448
555
  });
449
- _context11.next = 34;
556
+ _context13.next = 34;
450
557
  return wait();
451
558
  case 34:
452
- // 验证两个选项都被选中
559
+ // check two options are selected
453
560
  expect(instance.get('days')).to.eql(['custom1', 'custom2']);
454
561
  expect(input.value).to.eql('');
455
- // 6. 测试原有选项的正常行为
562
+ // test the normal behavior of original options
456
563
  input.click();
457
- _context11.next = 39;
564
+ _context13.next = 39;
458
565
  return wait();
459
566
  case 39:
460
567
  mondayOption = dropdown.querySelector('[data-value="Monday"]');
461
568
  if (!mondayOption) {
462
- _context11.next = 49;
569
+ _context13.next = 49;
463
570
  break;
464
571
  }
465
572
  mondayOption.click();
466
- _context11.next = 44;
573
+ _context13.next = 44;
467
574
  return wait();
468
575
  case 44:
469
576
  expect(instance.get('days')).to.include('Monday');
470
- // 再次点击应该能取消选中(原有选项不受keepKeywords影响)
577
+ // click again should be unselected (original options are not affected by keepKeywords)
471
578
  mondayOption.click();
472
- _context11.next = 48;
579
+ _context13.next = 48;
473
580
  return wait();
474
581
  case 48:
475
582
  expect(instance.get('days')).to.not.include('Monday');
476
583
  case 49:
477
584
  case "end":
478
- return _context11.stop();
585
+ return _context13.stop();
479
586
  }
480
- }, _callee9);
587
+ }, _callee11);
481
588
  })));
482
- it('Tooltip with Select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
483
- var Demo, _mount11, instance, element;
484
- return _regeneratorRuntime.wrap(function _callee10$(_context13) {
485
- while (1) switch (_context13.prev = _context13.next) {
589
+ it('Tooltip with Select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
590
+ var Demo, _mount12, instance, element;
591
+ return _regeneratorRuntime.wrap(function _callee12$(_context15) {
592
+ while (1) switch (_context15.prev = _context15.next) {
486
593
  case 0:
487
594
  Demo = /*#__PURE__*/function (_Component3) {
488
595
  _inheritsLoose(Demo, _Component3);
489
596
  function Demo() {
490
- var _context12;
597
+ var _context14;
491
598
  var _this3;
492
599
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
493
600
  args[_key3] = arguments[_key3];
494
601
  }
495
- _this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context12 = [this]).call(_context12, args)) || this;
602
+ _this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context14 = [this]).call(_context14, args)) || this;
496
603
  _this3.Tooltip = Tooltip;
497
604
  _this3.Select = Select;
498
605
  _this3.Option = Option;
@@ -501,28 +608,28 @@ describe('Select', function () {
501
608
  return Demo;
502
609
  }(Component);
503
610
  Demo.template = "\n const {Tooltip, Select, Option} = this;\n <Tooltip content=\"hello\">\n <Select><Option value=\"1\">option 1</Option></Select>\n </Tooltip>\n ";
504
- _mount11 = mount(Demo), instance = _mount11[0], element = _mount11[1];
611
+ _mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
505
612
  element.click();
506
- _context13.next = 6;
613
+ _context15.next = 6;
507
614
  return wait();
508
615
  case 6:
509
616
  expect(getElement('.k-select-menu')).to.be.exist;
510
617
  expect(getElement('.k-tooltip-content')).to.be.exist;
511
618
  case 8:
512
619
  case "end":
513
- return _context13.stop();
620
+ return _context15.stop();
514
621
  }
515
- }, _callee10);
622
+ }, _callee12);
516
623
  })));
517
- it('Searchable with multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
518
- var _mount12, instance, element, _element$querySelecto6, select, dropdown, _dropdown$querySelect2, selectAll, toggleSelect, unselectAll, _dropdown$querySelect3, cancel, confirm, input;
519
- return _regeneratorRuntime.wrap(function _callee11$(_context14) {
520
- while (1) switch (_context14.prev = _context14.next) {
624
+ it('Searchable with multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
625
+ var _mount13, instance, element, _element$querySelecto8, select, dropdown, _dropdown$querySelect2, selectAll, toggleSelect, unselectAll, _dropdown$querySelect3, cancel, confirm, input;
626
+ return _regeneratorRuntime.wrap(function _callee13$(_context16) {
627
+ while (1) switch (_context16.prev = _context16.next) {
521
628
  case 0:
522
- _mount12 = mount(SearchableDemo), instance = _mount12[0], element = _mount12[1];
523
- _element$querySelecto6 = element.querySelectorAll('.k-select'), select = _element$querySelecto6[1];
629
+ _mount13 = mount(SearchableDemo), instance = _mount13[0], element = _mount13[1];
630
+ _element$querySelecto8 = element.querySelectorAll('.k-select'), select = _element$querySelecto8[1];
524
631
  select.click();
525
- _context14.next = 5;
632
+ _context16.next = 5;
526
633
  return wait();
527
634
  case 5:
528
635
  dropdown = getElement('.k-select-menu');
@@ -530,65 +637,86 @@ describe('Select', function () {
530
637
  _dropdown$querySelect3 = dropdown.querySelectorAll('.k-select-footer .k-btn'), cancel = _dropdown$querySelect3[0], confirm = _dropdown$querySelect3[1]; // select all
531
638
  selectAll.click();
532
639
  confirm.click();
533
- _context14.next = 12;
640
+ _context16.next = 12;
534
641
  return wait();
535
642
  case 12:
536
643
  expect(instance.get('days')).have.length(6);
537
644
  // unselect all
538
645
  select.click();
539
- _context14.next = 16;
646
+ _context16.next = 16;
540
647
  return wait();
541
648
  case 16:
542
649
  unselectAll.click();
543
650
  confirm.click();
544
- _context14.next = 20;
651
+ _context16.next = 20;
545
652
  return wait();
546
653
  case 20:
547
654
  expect(instance.get('days')).have.length(0);
548
655
  // toggle select
549
656
  select.click();
550
- _context14.next = 24;
657
+ _context16.next = 24;
551
658
  return wait();
552
659
  case 24:
553
660
  instance.set('days', ['Monday', 'Tuesday']);
554
- _context14.next = 27;
661
+ _context16.next = 27;
555
662
  return wait();
556
663
  case 27:
557
664
  input = dropdown.querySelector('.k-input-inner');
558
665
  input.value = 's';
559
666
  dispatchEvent(input, 'input');
560
- _context14.next = 32;
667
+ _context16.next = 32;
561
668
  return wait();
562
669
  case 32:
563
670
  toggleSelect.click();
564
671
  confirm.click();
565
- _context14.next = 36;
672
+ _context16.next = 36;
566
673
  return wait();
567
674
  case 36:
568
675
  expect(instance.get('days')).have.length(5);
569
676
  expect(instance.get('days')).include('Monday');
570
677
  case 38:
571
678
  case "end":
572
- return _context14.stop();
679
+ return _context16.stop();
573
680
  }
574
- }, _callee11);
681
+ }, _callee13);
575
682
  })));
576
- it('Searchable with multiple should show correct initial checkbox state', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
577
- var _mount13, instance, element, _element$querySelecto7, select, dropdown, checkboxes, options, tuesdayCheckbox, tuesdayOption, _dropdown$querySelect4, cancel, dropdown2, checkboxes2, options2, tuesdayCheckbox2, tuesdayOption2;
578
- return _regeneratorRuntime.wrap(function _callee12$(_context15) {
579
- while (1) switch (_context15.prev = _context15.next) {
683
+ it('Searchable with multiple should show correct initial checkbox state', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
684
+ var Demo, _mount14, instance, element, dropdown, checkboxes, options, tuesdayCheckbox, tuesdayOption, _dropdown$querySelect4, cancel, dropdown2, checkboxes2, options2, tuesdayCheckbox2, tuesdayOption2;
685
+ return _regeneratorRuntime.wrap(function _callee14$(_context18) {
686
+ while (1) switch (_context18.prev = _context18.next) {
580
687
  case 0:
581
- _mount13 = mount(SearchableDemo), instance = _mount13[0], element = _mount13[1]; // 验证初始值
688
+ Demo = /*#__PURE__*/function (_Component4) {
689
+ _inheritsLoose(Demo, _Component4);
690
+ function Demo() {
691
+ var _context17;
692
+ var _this4;
693
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
694
+ args[_key4] = arguments[_key4];
695
+ }
696
+ _this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context17 = [this]).call(_context17, args)) || this;
697
+ _this4.Tooltip = Tooltip;
698
+ _this4.Select = Select;
699
+ _this4.Option = Option;
700
+ return _this4;
701
+ }
702
+ Demo.defaults = function defaults() {
703
+ return {
704
+ days: ['Tuesday']
705
+ };
706
+ };
707
+ return Demo;
708
+ }(Component);
709
+ Demo.template = "\n const {Select, Option} = this;\n <Select v-model=\"days\" searchable multiple>\n <Option value=\"Monday\" disabled>\u661F\u671F\u4E00</Option>\n <Option value=\"Tuesday\">\u661F\u671F\u4E8C</Option>\n <Option value=\"Wednesday\">\u661F\u671F\u4E09</Option>\n <Option value=\"Thursday\">\u661F\u671F\u56DB</Option>\n <Option value=\"Friday\">\u661F\u671F\u4E94</Option>\n <Option value=\"Saturday\">\u661F\u671F\u516D</Option>\n <Option value=\"Sunday\">\u661F\u671F\u5929</Option>\n <b:values args=\"[value]\">\n <div class=\"k-value\">\n \u5DF2\u9009\u62E9{value.length}\u9879 / \u51717\u9879\n </div>\n </b:values>\n </Select>\n ";
710
+ _mount14 = mount(Demo), instance = _mount14[0], element = _mount14[1];
582
711
  expect(instance.get('days')).to.eql(['Tuesday']);
583
- // 第一次打开dropdown,检查初始状态
584
- _element$querySelecto7 = element.querySelectorAll('.k-select'), select = _element$querySelecto7[1];
585
- select.click();
586
- _context15.next = 6;
712
+ // first open dropdown, check initial state
713
+ element.click();
714
+ _context18.next = 7;
587
715
  return wait();
588
- case 6:
716
+ case 7:
589
717
  dropdown = getElement('.k-select-menu');
590
718
  checkboxes = dropdown.querySelectorAll('.k-checkbox input[type="checkbox"]');
591
- options = dropdown.querySelectorAll('.k-select-option'); // 找到Tuesday选项对应的checkbox
719
+ options = dropdown.querySelectorAll('.k-select-option'); // find the checkbox of Tuesday option
592
720
  tuesdayCheckbox = null;
593
721
  tuesdayOption = null;
594
722
  options.forEach(function (option, index) {
@@ -598,23 +726,23 @@ describe('Select', function () {
598
726
  tuesdayOption = option;
599
727
  }
600
728
  });
601
- // 验证Tuesday的checkbox应该被选中
729
+ // check the checkbox of Tuesday should be checked
602
730
  expect(tuesdayCheckbox).to.exist;
603
731
  expect(tuesdayCheckbox.checked).to.be.true;
604
- // 验证Tuesday选项应该有active样式
732
+ // check the Tuesday option should have active style
605
733
  expect(tuesdayOption).to.exist;
606
734
  expect(tuesdayOption.className).to.include('k-active');
607
- // 关闭dropdown
735
+ // close dropdown
608
736
  _dropdown$querySelect4 = dropdown.querySelectorAll('.k-select-footer .k-btn'), cancel = _dropdown$querySelect4[0];
609
737
  cancel.click();
610
- _context15.next = 20;
738
+ _context18.next = 21;
611
739
  return wait();
612
- case 20:
613
- // 再次打开dropdown,验证状态仍然正确
614
- select.click();
615
- _context15.next = 23;
740
+ case 21:
741
+ // reopen dropdown, check the state is still correct
742
+ element.click();
743
+ _context18.next = 24;
616
744
  return wait();
617
- case 23:
745
+ case 24:
618
746
  dropdown2 = getElement('.k-select-menu');
619
747
  checkboxes2 = dropdown2.querySelectorAll('.k-checkbox input[type="checkbox"]');
620
748
  options2 = dropdown2.querySelectorAll('.k-select-option');
@@ -627,78 +755,78 @@ describe('Select', function () {
627
755
  tuesdayOption2 = option;
628
756
  }
629
757
  });
630
- // 验证第二次打开时状态依然正确
758
+ // check the state is still correct when reopen
631
759
  expect(tuesdayCheckbox2.checked).to.be.true;
632
760
  expect(tuesdayOption2.className).to.include('k-active');
633
- case 31:
761
+ case 32:
634
762
  case "end":
635
- return _context15.stop();
763
+ return _context18.stop();
636
764
  }
637
- }, _callee12);
765
+ }, _callee14);
638
766
  })));
639
- it('disabled option does not allow clearable and close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
640
- var _mount14, instance, element, _element$querySelecto8, clear1, _element$querySelecto9, tag1, _element$querySelecto10, clear2, _element$querySelecto11, clear3;
641
- return _regeneratorRuntime.wrap(function _callee13$(_context16) {
642
- while (1) switch (_context16.prev = _context16.next) {
767
+ it('disabled option does not allow clearable and close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
768
+ var _mount15, instance, element, _element$querySelecto9, clear1, _element$querySelecto10, tag1, _element$querySelecto11, clear2, _element$querySelecto12, clear3;
769
+ return _regeneratorRuntime.wrap(function _callee15$(_context19) {
770
+ while (1) switch (_context19.prev = _context19.next) {
643
771
  case 0:
644
- _mount14 = mount(ImmutableDemo), instance = _mount14[0], element = _mount14[1];
772
+ _mount15 = mount(ImmutableDemo), instance = _mount15[0], element = _mount15[1];
645
773
  instance.set('days', ['Tuesday', 'Friday']);
646
- _context16.next = 4;
774
+ _context19.next = 4;
647
775
  return wait();
648
776
  case 4:
649
777
  expect(element.outerHTML).to.matchSnapshot();
650
- _element$querySelecto8 = element.querySelectorAll('.k-select-clear'), clear1 = _element$querySelecto8[0];
778
+ _element$querySelecto9 = element.querySelectorAll('.k-select-clear'), clear1 = _element$querySelecto9[0];
651
779
  clear1.click();
652
- _context16.next = 9;
780
+ _context19.next = 9;
653
781
  return wait();
654
782
  case 9:
655
- _element$querySelecto9 = element.querySelectorAll('.k-tag'), tag1 = _element$querySelecto9[0];
783
+ _element$querySelecto10 = element.querySelectorAll('.k-tag'), tag1 = _element$querySelecto10[0];
656
784
  expect(tag1.className).not.contain("k-closable");
657
785
  expect(instance.get('days')).to.eql(['Tuesday', 'Friday']);
658
786
  instance.set('days', ['Monday', 'Tuesday']);
659
- _context16.next = 15;
787
+ _context19.next = 15;
660
788
  return wait();
661
789
  case 15:
662
- _element$querySelecto10 = element.querySelectorAll('.k-select-clear'), clear2 = _element$querySelecto10[0];
790
+ _element$querySelecto11 = element.querySelectorAll('.k-select-clear'), clear2 = _element$querySelecto11[0];
663
791
  clear2.click();
664
- _context16.next = 19;
792
+ _context19.next = 19;
665
793
  return wait();
666
794
  case 19:
667
795
  expect(instance.get('days')).to.eql(['Tuesday']);
668
796
  instance.set('days', ['Monday', 'Wednesday']);
669
- _context16.next = 23;
797
+ _context19.next = 23;
670
798
  return wait();
671
799
  case 23:
672
- _element$querySelecto11 = element.querySelectorAll('.k-select-clear'), clear3 = _element$querySelecto11[0];
800
+ _element$querySelecto12 = element.querySelectorAll('.k-select-clear'), clear3 = _element$querySelecto12[0];
673
801
  clear3.click();
674
- _context16.next = 27;
802
+ _context19.next = 27;
675
803
  return wait();
676
804
  case 27:
677
805
  expect(instance.get('days')).to.eql([]);
678
806
  // expect(clear).to.be.null;
679
807
  case 28:
680
808
  case "end":
681
- return _context16.stop();
809
+ return _context19.stop();
682
810
  }
683
- }, _callee13);
811
+ }, _callee15);
684
812
  })));
685
- it('should handle async data correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
686
- var Demo, _mount15, instance, element, wrapper, phantom;
687
- return _regeneratorRuntime.wrap(function _callee14$(_context18) {
688
- while (1) switch (_context18.prev = _context18.next) {
813
+ it('should handle async data correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
814
+ var Demo, _mount16, instance, element, wrapper, phantom;
815
+ return _regeneratorRuntime.wrap(function _callee16$(_context21) {
816
+ while (1) switch (_context21.prev = _context21.next) {
689
817
  case 0:
690
- Demo = /*#__PURE__*/function (_Component4) {
691
- _inheritsLoose(Demo, _Component4);
818
+ Demo = /*#__PURE__*/function (_Component5) {
819
+ _inheritsLoose(Demo, _Component5);
692
820
  function Demo() {
693
- var _context17;
694
- var _this4;
695
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
696
- args[_key4] = arguments[_key4];
821
+ var _context20;
822
+ var _this5;
823
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
824
+ args[_key5] = arguments[_key5];
697
825
  }
698
- _this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context17 = [this]).call(_context17, args)) || this;
699
- _this4.Select = Select;
700
- _this4.Option = Option;
701
- return _this4;
826
+ _this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context20 = [this]).call(_context20, args)) || this;
827
+ _this5.Select = Select;
828
+ _this5.Option = Option;
829
+ return _this5;
702
830
  }
703
831
  Demo.defaults = function defaults() {
704
832
  return {
@@ -708,8 +836,8 @@ describe('Select', function () {
708
836
  return Demo;
709
837
  }(Component);
710
838
  Demo.template = "\n const {Select, Option} = this;\n <Select v-model=\"day\" virtual>\n <Option v-for={this.get('list')} value={$value}>\n {$value}\n </Option>\n </Select>\n ";
711
- _mount15 = mount(Demo), instance = _mount15[0], element = _mount15[1];
712
- _context18.next = 5;
839
+ _mount16 = mount(Demo), instance = _mount16[0], element = _mount16[1];
840
+ _context21.next = 5;
713
841
  return wait();
714
842
  case 5:
715
843
  // simulate async data loading
@@ -718,11 +846,11 @@ describe('Select', function () {
718
846
  }, function (_, i) {
719
847
  return i;
720
848
  }));
721
- _context18.next = 8;
849
+ _context21.next = 8;
722
850
  return wait(100);
723
851
  case 8:
724
852
  element.click();
725
- _context18.next = 11;
853
+ _context21.next = 11;
726
854
  return wait();
727
855
  case 11:
728
856
  wrapper = getElement('.k-virtual-wrapper');
@@ -731,9 +859,9 @@ describe('Select', function () {
731
859
  expect(phantom.style.height).to.be.equal('3000px');
732
860
  case 15:
733
861
  case "end":
734
- return _context18.stop();
862
+ return _context21.stop();
735
863
  }
736
- }, _callee14);
864
+ }, _callee16);
737
865
  })));
738
866
  // it('should trigger change event correctly', async () => {
739
867
  // const spy = sinon.spy();