@king-design/intact 3.6.0 → 3.6.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/button/demos/basic.md +0 -1
- package/components/copy/index.spec.ts +9 -14
- package/components/datepicker/index.spec.ts +55 -28
- package/components/datepicker/useValueBase.ts +5 -2
- package/components/dropdown/constants.ts +25 -0
- package/components/dropdown/item.ts +1 -2
- package/components/dropdown/menu.ts +1 -1
- package/components/dropdown/useItemKeyboard.ts +38 -0
- package/components/dropdown/{useKeyboard.ts → useMenuKeyboard.ts} +3 -62
- package/components/form/form.ts +4 -0
- package/components/form/index.md +2 -1
- package/components/form/index.spec.ts +2 -0
- package/components/menu/demos/horizontal.md +7 -1
- package/components/menu/index.spec.ts +19 -0
- package/components/menu/styles.ts +2 -1
- package/components/select/index.spec.ts +35 -2
- package/components/select/menu.ts +1 -1
- package/components/select/useCard.ts +22 -4
- package/components/spinner/index.spec.ts +18 -0
- package/components/spinner/useValue.ts +2 -1
- package/es/components/copy/index.spec.js +14 -31
- package/es/components/datepicker/index.spec.js +646 -608
- package/es/components/datepicker/useValueBase.js +5 -2
- package/es/components/dropdown/constants.d.ts +22 -0
- package/es/components/dropdown/constants.js +7 -0
- package/es/components/dropdown/item.js +1 -1
- package/es/components/dropdown/menu.js +1 -1
- package/es/components/dropdown/useItemKeyboard.d.ts +6 -0
- package/es/components/dropdown/useItemKeyboard.js +32 -0
- package/es/components/dropdown/useMenuKeyboard.d.ts +2 -0
- package/es/components/dropdown/{useKeyboard.js → useMenuKeyboard.js} +3 -38
- package/es/components/form/form.d.ts +1 -0
- package/es/components/form/form.js +7 -0
- package/es/components/form/index.spec.js +10 -8
- package/es/components/menu/index.spec.js +28 -0
- package/es/components/menu/styles.js +2 -2
- package/es/components/select/index.spec.js +231 -177
- package/es/components/select/menu.js +1 -1
- package/es/components/select/useCard.d.ts +4 -3
- package/es/components/select/useCard.js +15 -4
- package/es/components/spinner/index.spec.js +82 -44
- package/es/components/spinner/useValue.js +2 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/basic/react.js +0 -2
- package/es/site/data/components/menu/demos/horizontal/react.js +5 -1
- package/es/test/demos.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/components/.DS_Store +0 -0
- package/components/descriptions/.DS_Store +0 -0
- package/components/menu/.DS_Store +0 -0
- package/components/menu/demos/.DS_Store +0 -0
- package/components/table/.DS_Store +0 -0
- package/components/tour/.DS_Store +0 -0
- package/components/virtualList/.DS_Store +0 -0
- package/components/virtualList/demos/.DS_Store +0 -0
- package/es/components/dropdown/useKeyboard.d.ts +0 -23
- package/styles/.DS_Store +0 -0
|
@@ -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) {
|
|
304
|
+
case 0:
|
|
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) {
|
|
295
349
|
case 0:
|
|
296
|
-
|
|
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,31 +360,31 @@ 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');
|
|
326
380
|
expect(instance.get('day')).to.be.null;
|
|
327
381
|
input.click();
|
|
328
|
-
|
|
382
|
+
_context11.next = 6;
|
|
329
383
|
return wait();
|
|
330
384
|
case 6:
|
|
331
385
|
input.value = 'xxx';
|
|
332
386
|
dispatchEvent(input, 'input');
|
|
333
|
-
|
|
387
|
+
_context11.next = 10;
|
|
334
388
|
return wait();
|
|
335
389
|
case 10:
|
|
336
390
|
dropdown = getElement('.k-select-menu');
|
|
@@ -343,14 +397,14 @@ describe('Select', function () {
|
|
|
343
397
|
dispatchEvent(document, 'keydown', {
|
|
344
398
|
keyCode: 13
|
|
345
399
|
});
|
|
346
|
-
|
|
400
|
+
_context11.next = 18;
|
|
347
401
|
return wait();
|
|
348
402
|
case 18:
|
|
349
403
|
expect(instance.get('day')).to.eql('xxx');
|
|
350
404
|
expect(input.value).to.eql('xxx');
|
|
351
405
|
// reopen dropdown
|
|
352
406
|
input.click();
|
|
353
|
-
|
|
407
|
+
_context11.next = 23;
|
|
354
408
|
return wait();
|
|
355
409
|
case 23:
|
|
356
410
|
expect(element.innerHTML).to.matchSnapshot();
|
|
@@ -358,7 +412,7 @@ describe('Select', function () {
|
|
|
358
412
|
// input another custom option
|
|
359
413
|
input.value = 'yyy';
|
|
360
414
|
dispatchEvent(input, 'input');
|
|
361
|
-
|
|
415
|
+
_context11.next = 29;
|
|
362
416
|
return wait();
|
|
363
417
|
case 29:
|
|
364
418
|
expect(element.innerHTML).to.matchSnapshot();
|
|
@@ -368,29 +422,29 @@ describe('Select', function () {
|
|
|
368
422
|
expect(newCreateOption.textContent).to.contain('yyy');
|
|
369
423
|
// click outside to cancel selection
|
|
370
424
|
dispatchEvent(document, 'click');
|
|
371
|
-
|
|
425
|
+
_context11.next = 37;
|
|
372
426
|
return wait();
|
|
373
427
|
case 37:
|
|
374
428
|
expect(element.innerHTML).to.matchSnapshot();
|
|
375
429
|
expect(instance.get('day')).to.eql('xxx'); // should keep the original value
|
|
376
430
|
expect(input.value).to.eql('xxx'); // should restore the original value
|
|
377
431
|
// test multiple creatable
|
|
378
|
-
_element$
|
|
432
|
+
_element$querySelecto7 = element.querySelectorAll('.k-input-inner'), multipleInput = _element$querySelecto7[1];
|
|
379
433
|
expect(instance.get('days')).to.eql([]);
|
|
380
434
|
multipleInput.click();
|
|
381
|
-
|
|
435
|
+
_context11.next = 45;
|
|
382
436
|
return wait();
|
|
383
437
|
case 45:
|
|
384
438
|
multipleInput.value = 'custom1';
|
|
385
439
|
dispatchEvent(multipleInput, 'input');
|
|
386
|
-
|
|
440
|
+
_context11.next = 49;
|
|
387
441
|
return wait();
|
|
388
442
|
case 49:
|
|
389
443
|
// press enter to create and select the first custom option
|
|
390
444
|
dispatchEvent(document, 'keydown', {
|
|
391
445
|
keyCode: 13
|
|
392
446
|
});
|
|
393
|
-
|
|
447
|
+
_context11.next = 52;
|
|
394
448
|
return wait();
|
|
395
449
|
case 52:
|
|
396
450
|
expect(instance.get('days')).to.include('custom1');
|
|
@@ -399,7 +453,7 @@ describe('Select', function () {
|
|
|
399
453
|
dispatchEvent(document, 'keydown', {
|
|
400
454
|
keyCode: 13
|
|
401
455
|
});
|
|
402
|
-
|
|
456
|
+
_context11.next = 57;
|
|
403
457
|
return wait();
|
|
404
458
|
case 57:
|
|
405
459
|
expect(instance.get('days')).to.eql([]);
|
|
@@ -407,37 +461,37 @@ describe('Select', function () {
|
|
|
407
461
|
// test select original options
|
|
408
462
|
multipleInput.value = 'Monday';
|
|
409
463
|
dispatchEvent(multipleInput, 'input');
|
|
410
|
-
|
|
464
|
+
_context11.next = 63;
|
|
411
465
|
return wait();
|
|
412
466
|
case 63:
|
|
413
467
|
multipleDropdown = getElement('.k-select-menu');
|
|
414
468
|
mondayOption = multipleDropdown.querySelector('.k-select-option');
|
|
415
469
|
expect(mondayOption.textContent).to.eql('星期一');
|
|
416
470
|
mondayOption.click();
|
|
417
|
-
|
|
471
|
+
_context11.next = 69;
|
|
418
472
|
return wait();
|
|
419
473
|
case 69:
|
|
420
474
|
expect(instance.get('days')).to.include('Monday');
|
|
421
475
|
case 70:
|
|
422
476
|
case "end":
|
|
423
|
-
return
|
|
477
|
+
return _context11.stop();
|
|
424
478
|
}
|
|
425
|
-
},
|
|
479
|
+
}, _callee10);
|
|
426
480
|
})));
|
|
427
|
-
it('keepKeywords', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
428
|
-
var KeepKeywordsDemo,
|
|
429
|
-
return _regeneratorRuntime.wrap(function
|
|
430
|
-
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) {
|
|
431
485
|
case 0:
|
|
432
486
|
KeepKeywordsDemo = /*#__PURE__*/function (_Component2) {
|
|
433
487
|
_inheritsLoose(KeepKeywordsDemo, _Component2);
|
|
434
488
|
function KeepKeywordsDemo() {
|
|
435
|
-
var
|
|
489
|
+
var _context12;
|
|
436
490
|
var _this2;
|
|
437
491
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
438
492
|
args[_key2] = arguments[_key2];
|
|
439
493
|
}
|
|
440
|
-
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(
|
|
494
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context12 = [this]).call(_context12, args)) || this;
|
|
441
495
|
_this2.Select = Select;
|
|
442
496
|
_this2.Option = Option;
|
|
443
497
|
return _this2;
|
|
@@ -450,15 +504,15 @@ describe('Select', function () {
|
|
|
450
504
|
return KeepKeywordsDemo;
|
|
451
505
|
}(Component);
|
|
452
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 ";
|
|
453
|
-
|
|
507
|
+
_mount11 = mount(KeepKeywordsDemo), instance = _mount11[0], element = _mount11[1];
|
|
454
508
|
input = element.querySelector('.k-input-inner'); // input custom option "custom1"
|
|
455
509
|
input.click();
|
|
456
|
-
|
|
510
|
+
_context13.next = 7;
|
|
457
511
|
return wait();
|
|
458
512
|
case 7:
|
|
459
513
|
input.value = 'custom1';
|
|
460
514
|
dispatchEvent(input, 'input');
|
|
461
|
-
|
|
515
|
+
_context13.next = 11;
|
|
462
516
|
return wait();
|
|
463
517
|
case 11:
|
|
464
518
|
// check the created option appears in dropdown
|
|
@@ -468,7 +522,7 @@ describe('Select', function () {
|
|
|
468
522
|
dispatchEvent(document, 'keydown', {
|
|
469
523
|
keyCode: 13
|
|
470
524
|
});
|
|
471
|
-
|
|
525
|
+
_context13.next = 16;
|
|
472
526
|
return wait();
|
|
473
527
|
case 16:
|
|
474
528
|
// check the option is selected, and the input is cleared
|
|
@@ -477,14 +531,14 @@ describe('Select', function () {
|
|
|
477
531
|
// input the same option "custom1" again
|
|
478
532
|
input.value = 'custom1';
|
|
479
533
|
dispatchEvent(input, 'input');
|
|
480
|
-
|
|
534
|
+
_context13.next = 22;
|
|
481
535
|
return wait();
|
|
482
536
|
case 22:
|
|
483
537
|
// press enter again
|
|
484
538
|
dispatchEvent(document, 'keydown', {
|
|
485
539
|
keyCode: 13
|
|
486
540
|
});
|
|
487
|
-
|
|
541
|
+
_context13.next = 25;
|
|
488
542
|
return wait();
|
|
489
543
|
case 25:
|
|
490
544
|
// check the option is still selected (not be unselected), and the input is cleared
|
|
@@ -493,13 +547,13 @@ describe('Select', function () {
|
|
|
493
547
|
// input another custom option "custom2"
|
|
494
548
|
input.value = 'custom2';
|
|
495
549
|
dispatchEvent(input, 'input');
|
|
496
|
-
|
|
550
|
+
_context13.next = 31;
|
|
497
551
|
return wait();
|
|
498
552
|
case 31:
|
|
499
553
|
dispatchEvent(document, 'keydown', {
|
|
500
554
|
keyCode: 13
|
|
501
555
|
});
|
|
502
|
-
|
|
556
|
+
_context13.next = 34;
|
|
503
557
|
return wait();
|
|
504
558
|
case 34:
|
|
505
559
|
// check two options are selected
|
|
@@ -507,45 +561,45 @@ describe('Select', function () {
|
|
|
507
561
|
expect(input.value).to.eql('');
|
|
508
562
|
// test the normal behavior of original options
|
|
509
563
|
input.click();
|
|
510
|
-
|
|
564
|
+
_context13.next = 39;
|
|
511
565
|
return wait();
|
|
512
566
|
case 39:
|
|
513
567
|
mondayOption = dropdown.querySelector('[data-value="Monday"]');
|
|
514
568
|
if (!mondayOption) {
|
|
515
|
-
|
|
569
|
+
_context13.next = 49;
|
|
516
570
|
break;
|
|
517
571
|
}
|
|
518
572
|
mondayOption.click();
|
|
519
|
-
|
|
573
|
+
_context13.next = 44;
|
|
520
574
|
return wait();
|
|
521
575
|
case 44:
|
|
522
576
|
expect(instance.get('days')).to.include('Monday');
|
|
523
577
|
// click again should be unselected (original options are not affected by keepKeywords)
|
|
524
578
|
mondayOption.click();
|
|
525
|
-
|
|
579
|
+
_context13.next = 48;
|
|
526
580
|
return wait();
|
|
527
581
|
case 48:
|
|
528
582
|
expect(instance.get('days')).to.not.include('Monday');
|
|
529
583
|
case 49:
|
|
530
584
|
case "end":
|
|
531
|
-
return
|
|
585
|
+
return _context13.stop();
|
|
532
586
|
}
|
|
533
|
-
},
|
|
587
|
+
}, _callee11);
|
|
534
588
|
})));
|
|
535
|
-
it('Tooltip with Select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
536
|
-
var Demo,
|
|
537
|
-
return _regeneratorRuntime.wrap(function
|
|
538
|
-
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) {
|
|
539
593
|
case 0:
|
|
540
594
|
Demo = /*#__PURE__*/function (_Component3) {
|
|
541
595
|
_inheritsLoose(Demo, _Component3);
|
|
542
596
|
function Demo() {
|
|
543
|
-
var
|
|
597
|
+
var _context14;
|
|
544
598
|
var _this3;
|
|
545
599
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
546
600
|
args[_key3] = arguments[_key3];
|
|
547
601
|
}
|
|
548
|
-
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(
|
|
602
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context14 = [this]).call(_context14, args)) || this;
|
|
549
603
|
_this3.Tooltip = Tooltip;
|
|
550
604
|
_this3.Select = Select;
|
|
551
605
|
_this3.Option = Option;
|
|
@@ -554,28 +608,28 @@ describe('Select', function () {
|
|
|
554
608
|
return Demo;
|
|
555
609
|
}(Component);
|
|
556
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 ";
|
|
557
|
-
|
|
611
|
+
_mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
|
|
558
612
|
element.click();
|
|
559
|
-
|
|
613
|
+
_context15.next = 6;
|
|
560
614
|
return wait();
|
|
561
615
|
case 6:
|
|
562
616
|
expect(getElement('.k-select-menu')).to.be.exist;
|
|
563
617
|
expect(getElement('.k-tooltip-content')).to.be.exist;
|
|
564
618
|
case 8:
|
|
565
619
|
case "end":
|
|
566
|
-
return
|
|
620
|
+
return _context15.stop();
|
|
567
621
|
}
|
|
568
|
-
},
|
|
622
|
+
}, _callee12);
|
|
569
623
|
})));
|
|
570
|
-
it('Searchable with multiple', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
571
|
-
var
|
|
572
|
-
return _regeneratorRuntime.wrap(function
|
|
573
|
-
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) {
|
|
574
628
|
case 0:
|
|
575
|
-
|
|
576
|
-
_element$
|
|
629
|
+
_mount13 = mount(SearchableDemo), instance = _mount13[0], element = _mount13[1];
|
|
630
|
+
_element$querySelecto8 = element.querySelectorAll('.k-select'), select = _element$querySelecto8[1];
|
|
577
631
|
select.click();
|
|
578
|
-
|
|
632
|
+
_context16.next = 5;
|
|
579
633
|
return wait();
|
|
580
634
|
case 5:
|
|
581
635
|
dropdown = getElement('.k-select-menu');
|
|
@@ -583,63 +637,63 @@ describe('Select', function () {
|
|
|
583
637
|
_dropdown$querySelect3 = dropdown.querySelectorAll('.k-select-footer .k-btn'), cancel = _dropdown$querySelect3[0], confirm = _dropdown$querySelect3[1]; // select all
|
|
584
638
|
selectAll.click();
|
|
585
639
|
confirm.click();
|
|
586
|
-
|
|
640
|
+
_context16.next = 12;
|
|
587
641
|
return wait();
|
|
588
642
|
case 12:
|
|
589
643
|
expect(instance.get('days')).have.length(6);
|
|
590
644
|
// unselect all
|
|
591
645
|
select.click();
|
|
592
|
-
|
|
646
|
+
_context16.next = 16;
|
|
593
647
|
return wait();
|
|
594
648
|
case 16:
|
|
595
649
|
unselectAll.click();
|
|
596
650
|
confirm.click();
|
|
597
|
-
|
|
651
|
+
_context16.next = 20;
|
|
598
652
|
return wait();
|
|
599
653
|
case 20:
|
|
600
654
|
expect(instance.get('days')).have.length(0);
|
|
601
655
|
// toggle select
|
|
602
656
|
select.click();
|
|
603
|
-
|
|
657
|
+
_context16.next = 24;
|
|
604
658
|
return wait();
|
|
605
659
|
case 24:
|
|
606
660
|
instance.set('days', ['Monday', 'Tuesday']);
|
|
607
|
-
|
|
661
|
+
_context16.next = 27;
|
|
608
662
|
return wait();
|
|
609
663
|
case 27:
|
|
610
664
|
input = dropdown.querySelector('.k-input-inner');
|
|
611
665
|
input.value = 's';
|
|
612
666
|
dispatchEvent(input, 'input');
|
|
613
|
-
|
|
667
|
+
_context16.next = 32;
|
|
614
668
|
return wait();
|
|
615
669
|
case 32:
|
|
616
670
|
toggleSelect.click();
|
|
617
671
|
confirm.click();
|
|
618
|
-
|
|
672
|
+
_context16.next = 36;
|
|
619
673
|
return wait();
|
|
620
674
|
case 36:
|
|
621
675
|
expect(instance.get('days')).have.length(5);
|
|
622
676
|
expect(instance.get('days')).include('Monday');
|
|
623
677
|
case 38:
|
|
624
678
|
case "end":
|
|
625
|
-
return
|
|
679
|
+
return _context16.stop();
|
|
626
680
|
}
|
|
627
|
-
},
|
|
681
|
+
}, _callee13);
|
|
628
682
|
})));
|
|
629
|
-
it('Searchable with multiple should show correct initial checkbox state', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
630
|
-
var Demo,
|
|
631
|
-
return _regeneratorRuntime.wrap(function
|
|
632
|
-
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) {
|
|
633
687
|
case 0:
|
|
634
688
|
Demo = /*#__PURE__*/function (_Component4) {
|
|
635
689
|
_inheritsLoose(Demo, _Component4);
|
|
636
690
|
function Demo() {
|
|
637
|
-
var
|
|
691
|
+
var _context17;
|
|
638
692
|
var _this4;
|
|
639
693
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
640
694
|
args[_key4] = arguments[_key4];
|
|
641
695
|
}
|
|
642
|
-
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(
|
|
696
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context17 = [this]).call(_context17, args)) || this;
|
|
643
697
|
_this4.Tooltip = Tooltip;
|
|
644
698
|
_this4.Select = Select;
|
|
645
699
|
_this4.Option = Option;
|
|
@@ -653,11 +707,11 @@ describe('Select', function () {
|
|
|
653
707
|
return Demo;
|
|
654
708
|
}(Component);
|
|
655
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 ";
|
|
656
|
-
|
|
710
|
+
_mount14 = mount(Demo), instance = _mount14[0], element = _mount14[1];
|
|
657
711
|
expect(instance.get('days')).to.eql(['Tuesday']);
|
|
658
712
|
// first open dropdown, check initial state
|
|
659
713
|
element.click();
|
|
660
|
-
|
|
714
|
+
_context18.next = 7;
|
|
661
715
|
return wait();
|
|
662
716
|
case 7:
|
|
663
717
|
dropdown = getElement('.k-select-menu');
|
|
@@ -681,12 +735,12 @@ describe('Select', function () {
|
|
|
681
735
|
// close dropdown
|
|
682
736
|
_dropdown$querySelect4 = dropdown.querySelectorAll('.k-select-footer .k-btn'), cancel = _dropdown$querySelect4[0];
|
|
683
737
|
cancel.click();
|
|
684
|
-
|
|
738
|
+
_context18.next = 21;
|
|
685
739
|
return wait();
|
|
686
740
|
case 21:
|
|
687
741
|
// reopen dropdown, check the state is still correct
|
|
688
742
|
element.click();
|
|
689
|
-
|
|
743
|
+
_context18.next = 24;
|
|
690
744
|
return wait();
|
|
691
745
|
case 24:
|
|
692
746
|
dropdown2 = getElement('.k-select-menu');
|
|
@@ -706,70 +760,70 @@ describe('Select', function () {
|
|
|
706
760
|
expect(tuesdayOption2.className).to.include('k-active');
|
|
707
761
|
case 32:
|
|
708
762
|
case "end":
|
|
709
|
-
return
|
|
763
|
+
return _context18.stop();
|
|
710
764
|
}
|
|
711
|
-
},
|
|
765
|
+
}, _callee14);
|
|
712
766
|
})));
|
|
713
|
-
it('disabled option does not allow clearable and close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
714
|
-
var
|
|
715
|
-
return _regeneratorRuntime.wrap(function
|
|
716
|
-
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) {
|
|
717
771
|
case 0:
|
|
718
|
-
|
|
772
|
+
_mount15 = mount(ImmutableDemo), instance = _mount15[0], element = _mount15[1];
|
|
719
773
|
instance.set('days', ['Tuesday', 'Friday']);
|
|
720
|
-
|
|
774
|
+
_context19.next = 4;
|
|
721
775
|
return wait();
|
|
722
776
|
case 4:
|
|
723
777
|
expect(element.outerHTML).to.matchSnapshot();
|
|
724
|
-
_element$
|
|
778
|
+
_element$querySelecto9 = element.querySelectorAll('.k-select-clear'), clear1 = _element$querySelecto9[0];
|
|
725
779
|
clear1.click();
|
|
726
|
-
|
|
780
|
+
_context19.next = 9;
|
|
727
781
|
return wait();
|
|
728
782
|
case 9:
|
|
729
|
-
_element$
|
|
783
|
+
_element$querySelecto10 = element.querySelectorAll('.k-tag'), tag1 = _element$querySelecto10[0];
|
|
730
784
|
expect(tag1.className).not.contain("k-closable");
|
|
731
785
|
expect(instance.get('days')).to.eql(['Tuesday', 'Friday']);
|
|
732
786
|
instance.set('days', ['Monday', 'Tuesday']);
|
|
733
|
-
|
|
787
|
+
_context19.next = 15;
|
|
734
788
|
return wait();
|
|
735
789
|
case 15:
|
|
736
|
-
_element$
|
|
790
|
+
_element$querySelecto11 = element.querySelectorAll('.k-select-clear'), clear2 = _element$querySelecto11[0];
|
|
737
791
|
clear2.click();
|
|
738
|
-
|
|
792
|
+
_context19.next = 19;
|
|
739
793
|
return wait();
|
|
740
794
|
case 19:
|
|
741
795
|
expect(instance.get('days')).to.eql(['Tuesday']);
|
|
742
796
|
instance.set('days', ['Monday', 'Wednesday']);
|
|
743
|
-
|
|
797
|
+
_context19.next = 23;
|
|
744
798
|
return wait();
|
|
745
799
|
case 23:
|
|
746
|
-
_element$
|
|
800
|
+
_element$querySelecto12 = element.querySelectorAll('.k-select-clear'), clear3 = _element$querySelecto12[0];
|
|
747
801
|
clear3.click();
|
|
748
|
-
|
|
802
|
+
_context19.next = 27;
|
|
749
803
|
return wait();
|
|
750
804
|
case 27:
|
|
751
805
|
expect(instance.get('days')).to.eql([]);
|
|
752
806
|
// expect(clear).to.be.null;
|
|
753
807
|
case 28:
|
|
754
808
|
case "end":
|
|
755
|
-
return
|
|
809
|
+
return _context19.stop();
|
|
756
810
|
}
|
|
757
|
-
},
|
|
811
|
+
}, _callee15);
|
|
758
812
|
})));
|
|
759
|
-
it('should handle async data correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
760
|
-
var Demo,
|
|
761
|
-
return _regeneratorRuntime.wrap(function
|
|
762
|
-
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) {
|
|
763
817
|
case 0:
|
|
764
818
|
Demo = /*#__PURE__*/function (_Component5) {
|
|
765
819
|
_inheritsLoose(Demo, _Component5);
|
|
766
820
|
function Demo() {
|
|
767
|
-
var
|
|
821
|
+
var _context20;
|
|
768
822
|
var _this5;
|
|
769
823
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
770
824
|
args[_key5] = arguments[_key5];
|
|
771
825
|
}
|
|
772
|
-
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(
|
|
826
|
+
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context20 = [this]).call(_context20, args)) || this;
|
|
773
827
|
_this5.Select = Select;
|
|
774
828
|
_this5.Option = Option;
|
|
775
829
|
return _this5;
|
|
@@ -782,8 +836,8 @@ describe('Select', function () {
|
|
|
782
836
|
return Demo;
|
|
783
837
|
}(Component);
|
|
784
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 ";
|
|
785
|
-
|
|
786
|
-
|
|
839
|
+
_mount16 = mount(Demo), instance = _mount16[0], element = _mount16[1];
|
|
840
|
+
_context21.next = 5;
|
|
787
841
|
return wait();
|
|
788
842
|
case 5:
|
|
789
843
|
// simulate async data loading
|
|
@@ -792,11 +846,11 @@ describe('Select', function () {
|
|
|
792
846
|
}, function (_, i) {
|
|
793
847
|
return i;
|
|
794
848
|
}));
|
|
795
|
-
|
|
849
|
+
_context21.next = 8;
|
|
796
850
|
return wait(100);
|
|
797
851
|
case 8:
|
|
798
852
|
element.click();
|
|
799
|
-
|
|
853
|
+
_context21.next = 11;
|
|
800
854
|
return wait();
|
|
801
855
|
case 11:
|
|
802
856
|
wrapper = getElement('.k-virtual-wrapper');
|
|
@@ -805,9 +859,9 @@ describe('Select', function () {
|
|
|
805
859
|
expect(phantom.style.height).to.be.equal('3000px');
|
|
806
860
|
case 15:
|
|
807
861
|
case "end":
|
|
808
|
-
return
|
|
862
|
+
return _context21.stop();
|
|
809
863
|
}
|
|
810
|
-
},
|
|
864
|
+
}, _callee16);
|
|
811
865
|
})));
|
|
812
866
|
// it('should trigger change event correctly', async () => {
|
|
813
867
|
// const spy = sinon.spy();
|