@king-design/vue 3.6.0-beta.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/__snapshots__/Vue Next Demos.md +115 -51
- package/__tests__/components/editable.spec.ts +1 -1
- package/__tests__/components/misc.spec.ts +93 -0
- package/__tests__/components/table.spec.ts +1 -0
- package/components/cascader/index.spec.js +18 -19
- package/components/copy/index.spec.js +14 -31
- package/components/datepicker/basepicker.d.ts +6 -27
- package/components/datepicker/basepicker.js +23 -268
- package/components/datepicker/calendar.d.ts +4 -2
- package/components/datepicker/dayjs.d.ts +2 -13
- package/components/datepicker/helpers.d.ts +3 -2
- package/components/datepicker/helpers.js +2 -3
- package/components/datepicker/index.d.ts +21 -29
- package/components/datepicker/index.js +22 -32
- package/components/datepicker/index.spec.js +1277 -484
- package/components/datepicker/index.vdt.js +39 -38
- package/components/datepicker/shortcuts.d.ts +1 -1
- package/components/datepicker/styles.d.ts +7 -2
- package/components/datepicker/styles.js +10 -15
- package/components/datepicker/useConfirm.d.ts +6 -0
- package/components/datepicker/useConfirm.js +65 -0
- package/components/datepicker/useDisabled.d.ts +5 -3
- package/components/datepicker/useDisabled.js +22 -27
- package/components/datepicker/useFormats.d.ts +2 -2
- package/components/datepicker/useFormats.js +6 -2
- package/components/datepicker/useHighlight.d.ts +14 -0
- package/components/datepicker/useHighlight.js +60 -0
- package/components/datepicker/useKeyboards.js +2 -1
- package/components/datepicker/useMergeRange.d.ts +1 -1
- package/components/datepicker/useMergeRange.js +11 -16
- package/components/datepicker/useMonths.js +5 -3
- package/components/datepicker/usePanel.d.ts +1 -10
- package/components/datepicker/usePanel.js +19 -32
- package/components/datepicker/useShowDate.d.ts +1 -1
- package/components/datepicker/useShowDate.js +15 -40
- package/components/datepicker/useStatus.js +33 -16
- package/components/datepicker/useValue.d.ts +11 -6
- package/components/datepicker/useValue.js +49 -69
- package/components/datepicker/useValueBase.d.ts +28 -0
- package/components/datepicker/useValueBase.js +280 -0
- package/components/datepicker/useYears.js +6 -3
- package/components/dropdown/dropdown.d.ts +1 -0
- package/components/dropdown/dropdown.js +7 -4
- package/components/form/form.d.ts +1 -0
- package/components/form/form.js +7 -0
- package/components/form/index.spec.js +10 -8
- package/components/input/index.d.ts +2 -0
- package/components/input/index.js +6 -0
- package/components/input/index.spec.js +45 -0
- package/components/input/index.vdt.js +4 -3
- package/components/input/useAutoWidth.d.ts +2 -0
- package/components/input/useAutoWidth.js +19 -1
- package/components/menu/index.spec.js +28 -0
- package/components/menu/styles.js +2 -2
- package/components/scrollSelect/useMouseEvents.js +5 -4
- package/components/select/base.d.ts +1 -1
- package/components/select/base.js +3 -2
- package/components/select/base.vdt.js +4 -3
- package/components/select/index.spec.js +346 -218
- package/components/select/menu.js +1 -1
- package/components/select/option.js +2 -1
- package/components/select/select.js +2 -1
- package/components/select/styles.d.ts +79 -0
- package/components/select/styles.js +1 -0
- package/components/select/useCard.d.ts +4 -3
- package/components/select/useCard.js +15 -4
- package/components/select/useInput.d.ts +1 -1
- package/components/select/useInput.js +4 -4
- package/components/spinner/index.spec.js +82 -44
- package/components/spinner/useValue.js +2 -1
- package/components/table/index.spec.js +84 -6
- package/components/table/useStickyHeader.js +1 -1
- package/components/timepicker/index.spec.js +298 -128
- package/components/timepicker/panelPicker.d.ts +21 -16
- package/components/timepicker/panelPicker.js +7 -4
- package/components/timepicker/panelPicker.vdt.js +5 -9
- package/components/timepicker/selectPicker.d.ts +4 -3
- package/components/timepicker/styles.js +1 -1
- package/components/timepicker/useConfirm.d.ts +6 -0
- package/components/timepicker/useConfirm.js +19 -0
- package/components/timepicker/useDefaultValue.d.ts +4 -0
- package/components/timepicker/useDefaultValue.js +27 -0
- package/components/timepicker/useDisabled.d.ts +6 -3
- package/components/timepicker/useDisabled.js +13 -4
- package/components/timepicker/useFormats.d.ts +1 -1
- package/components/timepicker/useValue.d.ts +13 -8
- package/components/timepicker/useValue.js +14 -15
- package/components/tour/index.spec.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
- package/yarn-error.log +44 -43
- package/components/datepicker/usePosition.d.ts +0 -10
- package/components/datepicker/usePosition.js +0 -166
|
@@ -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 (
|
|
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
|
-
|
|
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
|
-
|
|
49
|
+
_context2.next = 12;
|
|
41
50
|
return wait();
|
|
42
51
|
case 12:
|
|
43
52
|
expect(element.outerHTML).to.matchSnapshot();
|
|
44
53
|
trigger.click();
|
|
45
|
-
|
|
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
|
|
61
|
+
return _context2.stop();
|
|
53
62
|
}
|
|
54
|
-
},
|
|
63
|
+
}, _callee2);
|
|
55
64
|
})));
|
|
56
|
-
it('disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
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
|
|
59
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
86
|
+
return _context3.stop();
|
|
78
87
|
}
|
|
79
|
-
},
|
|
88
|
+
}, _callee3);
|
|
80
89
|
})));
|
|
81
|
-
it('clearable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
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
|
|
84
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
|
140
|
+
return _context5.stop();
|
|
132
141
|
}
|
|
133
|
-
},
|
|
142
|
+
}, _callee4);
|
|
134
143
|
})));
|
|
135
|
-
it('multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
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
|
|
138
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
174
|
+
return _context6.stop();
|
|
166
175
|
}
|
|
167
|
-
},
|
|
176
|
+
}, _callee5);
|
|
168
177
|
})));
|
|
169
|
-
it('filterable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
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
|
|
172
|
-
while (1) switch (
|
|
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
|
-
|
|
186
|
+
_context7.next = 5;
|
|
178
187
|
return wait();
|
|
179
188
|
case 5:
|
|
180
189
|
input1.value = 'm';
|
|
181
190
|
dispatchEvent(input1, 'input');
|
|
182
|
-
|
|
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
|
-
|
|
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
|
-
|
|
204
|
+
_context7.next = 18;
|
|
196
205
|
return wait();
|
|
197
206
|
case 18:
|
|
198
207
|
input2.value = '二';
|
|
199
208
|
dispatchEvent(input2, 'input');
|
|
200
|
-
|
|
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
|
-
|
|
217
|
+
_context7.next = 27;
|
|
209
218
|
return wait();
|
|
210
219
|
case 27:
|
|
211
220
|
input2.value = 'Wed';
|
|
212
221
|
dispatchEvent(input2, 'input');
|
|
213
|
-
|
|
222
|
+
_context7.next = 31;
|
|
214
223
|
return wait();
|
|
215
224
|
case 31:
|
|
216
225
|
dispatchEvent(document, 'keydown', {
|
|
217
226
|
keyCode: 13
|
|
218
227
|
});
|
|
219
|
-
|
|
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
|
-
|
|
233
|
+
_context7.next = 38;
|
|
225
234
|
return wait();
|
|
226
235
|
case 38:
|
|
227
236
|
input3.value = 'm';
|
|
228
237
|
dispatchEvent(input3, 'input');
|
|
229
|
-
|
|
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
|
-
|
|
244
|
+
_context7.next = 47;
|
|
236
245
|
return wait();
|
|
237
246
|
case 47:
|
|
238
247
|
dispatchEvent(document, 'keydown', {
|
|
239
248
|
keyCode: 13
|
|
240
249
|
});
|
|
241
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
268
|
+
return _context7.stop();
|
|
260
269
|
}
|
|
261
|
-
},
|
|
270
|
+
}, _callee6);
|
|
262
271
|
})));
|
|
263
|
-
it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
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
|
|
266
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
296
|
+
return _context8.stop();
|
|
288
297
|
}
|
|
289
|
-
},
|
|
298
|
+
}, _callee7);
|
|
290
299
|
})));
|
|
291
|
-
it('
|
|
292
|
-
var _mount8, instance, element,
|
|
293
|
-
return _regeneratorRuntime.wrap(function
|
|
294
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
369
|
+
return _context10.stop();
|
|
316
370
|
}
|
|
317
|
-
},
|
|
371
|
+
}, _callee9);
|
|
318
372
|
})));
|
|
319
|
-
it('creatable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
320
|
-
var
|
|
321
|
-
return _regeneratorRuntime.wrap(function
|
|
322
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
382
|
+
_context11.next = 6;
|
|
328
383
|
return wait();
|
|
329
|
-
case
|
|
384
|
+
case 6:
|
|
330
385
|
input.value = 'xxx';
|
|
331
386
|
dispatchEvent(input, 'input');
|
|
332
|
-
|
|
387
|
+
_context11.next = 10;
|
|
333
388
|
return wait();
|
|
334
|
-
case
|
|
389
|
+
case 10:
|
|
335
390
|
dropdown = getElement('.k-select-menu');
|
|
336
391
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
337
|
-
//
|
|
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
|
-
|
|
400
|
+
_context11.next = 18;
|
|
342
401
|
return wait();
|
|
343
|
-
case
|
|
402
|
+
case 18:
|
|
344
403
|
expect(instance.get('day')).to.eql('xxx');
|
|
345
|
-
|
|
404
|
+
expect(input.value).to.eql('xxx');
|
|
405
|
+
// reopen dropdown
|
|
346
406
|
input.click();
|
|
347
|
-
|
|
407
|
+
_context11.next = 23;
|
|
348
408
|
return wait();
|
|
349
|
-
case
|
|
409
|
+
case 23:
|
|
350
410
|
expect(element.innerHTML).to.matchSnapshot();
|
|
351
411
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
352
|
-
// input
|
|
412
|
+
// input another custom option
|
|
353
413
|
input.value = 'yyy';
|
|
354
414
|
dispatchEvent(input, 'input');
|
|
355
|
-
|
|
415
|
+
_context11.next = 29;
|
|
356
416
|
return wait();
|
|
357
|
-
case
|
|
417
|
+
case 29:
|
|
358
418
|
expect(element.innerHTML).to.matchSnapshot();
|
|
359
419
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
360
|
-
|
|
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
|
-
|
|
425
|
+
_context11.next = 37;
|
|
363
426
|
return wait();
|
|
364
|
-
case
|
|
427
|
+
case 37:
|
|
365
428
|
expect(element.innerHTML).to.matchSnapshot();
|
|
366
|
-
expect(instance.get('day')).to.eql('xxx');
|
|
367
|
-
|
|
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
|
|
477
|
+
return _context11.stop();
|
|
370
478
|
}
|
|
371
|
-
},
|
|
479
|
+
}, _callee10);
|
|
372
480
|
})));
|
|
373
|
-
it('keepKeywords', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
374
|
-
var KeepKeywordsDemo,
|
|
375
|
-
return _regeneratorRuntime.wrap(function
|
|
376
|
-
while (1) switch (
|
|
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
|
|
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(
|
|
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
|
-
|
|
401
|
-
input = element.querySelector('.k-input-inner'); //
|
|
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
|
-
|
|
510
|
+
_context13.next = 7;
|
|
404
511
|
return wait();
|
|
405
512
|
case 7:
|
|
406
513
|
input.value = 'custom1';
|
|
407
514
|
dispatchEvent(input, 'input');
|
|
408
|
-
|
|
515
|
+
_context13.next = 11;
|
|
409
516
|
return wait();
|
|
410
517
|
case 11:
|
|
411
|
-
//
|
|
518
|
+
// check the created option appears in dropdown
|
|
412
519
|
dropdown = getElement('.k-select-menu');
|
|
413
520
|
expect(dropdown.innerHTML).to.contain('custom1');
|
|
414
|
-
//
|
|
521
|
+
// press enter to create and select
|
|
415
522
|
dispatchEvent(document, 'keydown', {
|
|
416
523
|
keyCode: 13
|
|
417
524
|
});
|
|
418
|
-
|
|
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('');
|
|
424
|
-
//
|
|
530
|
+
expect(input.value).to.eql('');
|
|
531
|
+
// input the same option "custom1" again
|
|
425
532
|
input.value = 'custom1';
|
|
426
533
|
dispatchEvent(input, 'input');
|
|
427
|
-
|
|
534
|
+
_context13.next = 22;
|
|
428
535
|
return wait();
|
|
429
536
|
case 22:
|
|
430
|
-
//
|
|
537
|
+
// press enter again
|
|
431
538
|
dispatchEvent(document, 'keydown', {
|
|
432
539
|
keyCode: 13
|
|
433
540
|
});
|
|
434
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
550
|
+
_context13.next = 31;
|
|
444
551
|
return wait();
|
|
445
552
|
case 31:
|
|
446
553
|
dispatchEvent(document, 'keydown', {
|
|
447
554
|
keyCode: 13
|
|
448
555
|
});
|
|
449
|
-
|
|
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
|
-
//
|
|
562
|
+
// test the normal behavior of original options
|
|
456
563
|
input.click();
|
|
457
|
-
|
|
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
|
-
|
|
569
|
+
_context13.next = 49;
|
|
463
570
|
break;
|
|
464
571
|
}
|
|
465
572
|
mondayOption.click();
|
|
466
|
-
|
|
573
|
+
_context13.next = 44;
|
|
467
574
|
return wait();
|
|
468
575
|
case 44:
|
|
469
576
|
expect(instance.get('days')).to.include('Monday');
|
|
470
|
-
//
|
|
577
|
+
// click again should be unselected (original options are not affected by keepKeywords)
|
|
471
578
|
mondayOption.click();
|
|
472
|
-
|
|
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
|
|
585
|
+
return _context13.stop();
|
|
479
586
|
}
|
|
480
|
-
},
|
|
587
|
+
}, _callee11);
|
|
481
588
|
})));
|
|
482
|
-
it('Tooltip with Select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
483
|
-
var Demo,
|
|
484
|
-
return _regeneratorRuntime.wrap(function
|
|
485
|
-
while (1) switch (
|
|
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
|
|
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(
|
|
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
|
-
|
|
611
|
+
_mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
|
|
505
612
|
element.click();
|
|
506
|
-
|
|
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
|
|
620
|
+
return _context15.stop();
|
|
514
621
|
}
|
|
515
|
-
},
|
|
622
|
+
}, _callee12);
|
|
516
623
|
})));
|
|
517
|
-
it('Searchable with multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
518
|
-
var
|
|
519
|
-
return _regeneratorRuntime.wrap(function
|
|
520
|
-
while (1) switch (
|
|
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
|
-
|
|
523
|
-
_element$
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
646
|
+
_context16.next = 16;
|
|
540
647
|
return wait();
|
|
541
648
|
case 16:
|
|
542
649
|
unselectAll.click();
|
|
543
650
|
confirm.click();
|
|
544
|
-
|
|
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
|
-
|
|
657
|
+
_context16.next = 24;
|
|
551
658
|
return wait();
|
|
552
659
|
case 24:
|
|
553
660
|
instance.set('days', ['Monday', 'Tuesday']);
|
|
554
|
-
|
|
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
|
-
|
|
667
|
+
_context16.next = 32;
|
|
561
668
|
return wait();
|
|
562
669
|
case 32:
|
|
563
670
|
toggleSelect.click();
|
|
564
671
|
confirm.click();
|
|
565
|
-
|
|
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
|
|
679
|
+
return _context16.stop();
|
|
573
680
|
}
|
|
574
|
-
},
|
|
681
|
+
}, _callee13);
|
|
575
682
|
})));
|
|
576
|
-
it('Searchable with multiple should show correct initial checkbox state', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
577
|
-
var
|
|
578
|
-
return _regeneratorRuntime.wrap(function
|
|
579
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
//
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
_context15.next = 6;
|
|
712
|
+
// first open dropdown, check initial state
|
|
713
|
+
element.click();
|
|
714
|
+
_context18.next = 7;
|
|
587
715
|
return wait();
|
|
588
|
-
case
|
|
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'); //
|
|
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
|
-
//
|
|
729
|
+
// check the checkbox of Tuesday should be checked
|
|
602
730
|
expect(tuesdayCheckbox).to.exist;
|
|
603
731
|
expect(tuesdayCheckbox.checked).to.be.true;
|
|
604
|
-
//
|
|
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
|
-
//
|
|
735
|
+
// close dropdown
|
|
608
736
|
_dropdown$querySelect4 = dropdown.querySelectorAll('.k-select-footer .k-btn'), cancel = _dropdown$querySelect4[0];
|
|
609
737
|
cancel.click();
|
|
610
|
-
|
|
738
|
+
_context18.next = 21;
|
|
611
739
|
return wait();
|
|
612
|
-
case
|
|
613
|
-
//
|
|
614
|
-
|
|
615
|
-
|
|
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
|
|
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
|
|
761
|
+
case 32:
|
|
634
762
|
case "end":
|
|
635
|
-
return
|
|
763
|
+
return _context18.stop();
|
|
636
764
|
}
|
|
637
|
-
},
|
|
765
|
+
}, _callee14);
|
|
638
766
|
})));
|
|
639
|
-
it('disabled option does not allow clearable and close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
640
|
-
var
|
|
641
|
-
return _regeneratorRuntime.wrap(function
|
|
642
|
-
while (1) switch (
|
|
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
|
-
|
|
772
|
+
_mount15 = mount(ImmutableDemo), instance = _mount15[0], element = _mount15[1];
|
|
645
773
|
instance.set('days', ['Tuesday', 'Friday']);
|
|
646
|
-
|
|
774
|
+
_context19.next = 4;
|
|
647
775
|
return wait();
|
|
648
776
|
case 4:
|
|
649
777
|
expect(element.outerHTML).to.matchSnapshot();
|
|
650
|
-
_element$
|
|
778
|
+
_element$querySelecto9 = element.querySelectorAll('.k-select-clear'), clear1 = _element$querySelecto9[0];
|
|
651
779
|
clear1.click();
|
|
652
|
-
|
|
780
|
+
_context19.next = 9;
|
|
653
781
|
return wait();
|
|
654
782
|
case 9:
|
|
655
|
-
_element$
|
|
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
|
-
|
|
787
|
+
_context19.next = 15;
|
|
660
788
|
return wait();
|
|
661
789
|
case 15:
|
|
662
|
-
_element$
|
|
790
|
+
_element$querySelecto11 = element.querySelectorAll('.k-select-clear'), clear2 = _element$querySelecto11[0];
|
|
663
791
|
clear2.click();
|
|
664
|
-
|
|
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
|
-
|
|
797
|
+
_context19.next = 23;
|
|
670
798
|
return wait();
|
|
671
799
|
case 23:
|
|
672
|
-
_element$
|
|
800
|
+
_element$querySelecto12 = element.querySelectorAll('.k-select-clear'), clear3 = _element$querySelecto12[0];
|
|
673
801
|
clear3.click();
|
|
674
|
-
|
|
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
|
|
809
|
+
return _context19.stop();
|
|
682
810
|
}
|
|
683
|
-
},
|
|
811
|
+
}, _callee15);
|
|
684
812
|
})));
|
|
685
|
-
it('should handle async data correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
686
|
-
var Demo,
|
|
687
|
-
return _regeneratorRuntime.wrap(function
|
|
688
|
-
while (1) switch (
|
|
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 (
|
|
691
|
-
_inheritsLoose(Demo,
|
|
818
|
+
Demo = /*#__PURE__*/function (_Component5) {
|
|
819
|
+
_inheritsLoose(Demo, _Component5);
|
|
692
820
|
function Demo() {
|
|
693
|
-
var
|
|
694
|
-
var
|
|
695
|
-
for (var
|
|
696
|
-
args[
|
|
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
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
return
|
|
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
|
-
|
|
712
|
-
|
|
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
|
-
|
|
849
|
+
_context21.next = 8;
|
|
722
850
|
return wait(100);
|
|
723
851
|
case 8:
|
|
724
852
|
element.click();
|
|
725
|
-
|
|
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
|
|
862
|
+
return _context21.stop();
|
|
735
863
|
}
|
|
736
|
-
},
|
|
864
|
+
}, _callee16);
|
|
737
865
|
})));
|
|
738
866
|
// it('should trigger change event correctly', async () => {
|
|
739
867
|
// const spy = sinon.spy();
|