handsontable 0.34.1 → 0.34.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/.travis.yml +2 -0
- package/README.md +127 -96
- package/commonjs/core.js +11 -6
- package/commonjs/helpers/dom/element.js +4 -3
- package/commonjs/helpers/mixed.js +8 -4
- package/commonjs/index.js +5 -4
- package/commonjs/pluginHooks.js +18 -2
- package/commonjs/plugins/copyPaste/clipboardData.js +31 -0
- package/commonjs/plugins/copyPaste/contextMenuItem/copy.js +1 -2
- package/commonjs/plugins/copyPaste/contextMenuItem/cut.js +1 -2
- package/commonjs/plugins/copyPaste/copyPaste.js +127 -134
- package/commonjs/plugins/copyPaste/pasteEvent.js +19 -0
- package/commonjs/plugins/copyPaste/test/copyPaste.e2e.js +90 -189
- package/commonjs/plugins/copyPaste/test/textarea.unit.js +2 -2
- package/commonjs/plugins/copyPaste/textarea.js +2 -1
- package/commonjs/plugins/manualColumnMove/manualColumnMove.js +8 -11
- package/commonjs/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
- package/commonjs/plugins/manualRowMove/manualRowMove.js +9 -12
- package/commonjs/plugins/manualRowMove/test/manualRowMove.e2e.js +256 -60
- package/commonjs/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +40 -182
- package/commonjs/plugins/manualRowMove/ui/_base.js +2 -2
- package/commonjs/tableView.js +1 -0
- package/dist/handsontable.css +6 -5
- package/dist/handsontable.css.map +1 -1
- package/dist/handsontable.full.css +6 -5
- package/dist/handsontable.full.js +37721 -42290
- package/dist/handsontable.full.min.css +4 -4
- package/dist/handsontable.full.min.js +5 -5
- package/dist/handsontable.js +28732 -28433
- package/dist/handsontable.js.map +1 -1
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +3 -3
- package/es/core.js +11 -6
- package/es/helpers/dom/element.js +4 -3
- package/es/helpers/mixed.js +4 -4
- package/es/index.js +3 -4
- package/es/pluginHooks.js +18 -2
- package/es/plugins/copyPaste/clipboardData.js +27 -0
- package/es/plugins/copyPaste/contextMenuItem/copy.js +1 -2
- package/es/plugins/copyPaste/contextMenuItem/cut.js +1 -2
- package/es/plugins/copyPaste/copyPaste.js +124 -132
- package/es/plugins/copyPaste/pasteEvent.js +11 -0
- package/es/plugins/copyPaste/test/copyPaste.e2e.js +90 -189
- package/es/plugins/copyPaste/test/textarea.unit.js +2 -2
- package/es/plugins/copyPaste/textarea.js +2 -1
- package/es/plugins/manualColumnMove/manualColumnMove.js +8 -11
- package/es/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
- package/es/plugins/manualRowMove/manualRowMove.js +9 -12
- package/es/plugins/manualRowMove/test/manualRowMove.e2e.js +256 -60
- package/es/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +40 -182
- package/es/plugins/manualRowMove/ui/_base.js +2 -2
- package/es/tableView.js +1 -0
- package/handsontable.jquery.json +1 -1
- package/hot.config.js +1 -1
- package/package.json +5 -5
- package/src/3rdparty/walkontable/dist/walkontable.js +27234 -11175
- package/src/3rdparty/walkontable/dist/walkontable.js.map +1 -1
- package/src/3rdparty/walkontable/test/dist/helpers.entry.js +32 -36
- package/src/3rdparty/walkontable/test/dist/helpers.entry.js.map +1 -1
- package/src/3rdparty/walkontable/test/dist/specs.entry.js +36 -39
- package/src/3rdparty/walkontable/test/dist/specs.entry.js.map +1 -1
- package/src/core.js +11 -6
- package/src/css/handsontable.css +1 -2
- package/src/helpers/dom/element.js +4 -3
- package/src/helpers/mixed.js +3 -3
- package/src/index.js +1 -2
- package/src/pluginHooks.js +18 -2
- package/src/plugins/copyPaste/clipboardData.js +11 -0
- package/src/plugins/copyPaste/contextMenuItem/copy.js +1 -2
- package/src/plugins/copyPaste/contextMenuItem/cut.js +1 -2
- package/src/plugins/copyPaste/copyPaste.css +3 -1
- package/src/plugins/copyPaste/copyPaste.js +120 -127
- package/src/plugins/copyPaste/pasteEvent.js +7 -0
- package/src/plugins/copyPaste/test/copyPaste.e2e.js +75 -193
- package/src/plugins/copyPaste/test/textarea.unit.js +2 -2
- package/src/plugins/copyPaste/textarea.js +2 -1
- package/src/plugins/manualColumnMove/manualColumnMove.js +6 -9
- package/src/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
- package/src/plugins/manualRowMove/manualRowMove.js +7 -10
- package/src/plugins/manualRowMove/test/manualRowMove.e2e.js +282 -86
- package/src/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +51 -190
- package/src/plugins/manualRowMove/ui/_base.js +2 -2
- package/test/dist/e2e.entry.js +31381 -31131
- package/test/dist/e2e.entry.js.map +1 -1
- package/test/dist/helpers.entry.js +16 -19
- package/test/dist/helpers.entry.js.map +1 -1
- package/test/e2e/Core_listen.spec.js +32 -0
- package/test/e2e/Core_selection.spec.js +1 -1
- package/test/e2e/Core_validate.spec.js +29 -0
- package/test/e2e/renderers/checkboxRenderer.spec.js +20 -7
- package/test/e2e/settings/fragmentSelection.spec.js +12 -9
- package/test/scripts/trigger-pro-tests.sh +41 -0
- package/yarn.lock +260 -208
- package/.npmignore +0 -19
- package/demo/bower_components/numbro/package.json +0 -63
@@ -25,20 +25,20 @@ describe('manualRowMove', () => {
|
|
25
25
|
});
|
26
26
|
|
27
27
|
describe('init', () => {
|
28
|
-
it('should change row order at init',
|
28
|
+
it('should change row order at init', () => {
|
29
29
|
handsontable({
|
30
30
|
data: arrayOfObjects,
|
31
31
|
manualRowMove: [1, 2, 0]
|
32
32
|
});
|
33
33
|
|
34
|
-
expect(
|
35
|
-
expect(
|
36
|
-
expect(
|
34
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
|
35
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
|
36
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
37
37
|
});
|
38
38
|
});
|
39
39
|
|
40
40
|
describe('updateSettings', () => {
|
41
|
-
it('should be enabled after specifying it in updateSettings config',
|
41
|
+
it('should be enabled after specifying it in updateSettings config', () => {
|
42
42
|
handsontable({
|
43
43
|
data: arrayOfObjects,
|
44
44
|
rowHeaders: true
|
@@ -48,92 +48,92 @@ describe('manualRowMove', () => {
|
|
48
48
|
manualRowMove: true
|
49
49
|
});
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
52
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
53
53
|
|
54
|
-
expect(
|
54
|
+
expect(spec().$container.hasClass('after-selection--rows')).toBeGreaterThan(0);
|
55
55
|
});
|
56
56
|
|
57
|
-
it('should change the default row order with updateSettings',
|
57
|
+
it('should change the default row order with updateSettings', () => {
|
58
58
|
handsontable({
|
59
59
|
data: arrayOfObjects,
|
60
60
|
manualRowMove: true
|
61
61
|
});
|
62
62
|
|
63
|
-
expect(
|
64
|
-
expect(
|
65
|
-
expect(
|
63
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
64
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
65
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
66
66
|
|
67
67
|
updateSettings({
|
68
68
|
manualRowMove: [2, 1, 0]
|
69
69
|
});
|
70
70
|
|
71
|
-
expect(
|
72
|
-
expect(
|
73
|
-
expect(
|
71
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
|
72
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
73
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
74
74
|
});
|
75
75
|
|
76
|
-
it('should change row order with updateSettings',
|
76
|
+
it('should change row order with updateSettings', () => {
|
77
77
|
handsontable({
|
78
78
|
data: arrayOfObjects,
|
79
79
|
manualRowMove: [1, 2, 0]
|
80
80
|
});
|
81
81
|
|
82
|
-
expect(
|
83
|
-
expect(
|
84
|
-
expect(
|
82
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
|
83
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
|
84
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
85
85
|
|
86
86
|
updateSettings({
|
87
87
|
manualRowMove: [2, 1, 0]
|
88
88
|
});
|
89
89
|
|
90
|
-
expect(
|
91
|
-
expect(
|
92
|
-
expect(
|
90
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
|
91
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
92
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
93
93
|
});
|
94
94
|
|
95
|
-
it('should reset row order with updateSettings when undefined is passed',
|
95
|
+
it('should reset row order with updateSettings when undefined is passed', () => {
|
96
96
|
handsontable({
|
97
97
|
data: arrayOfObjects,
|
98
98
|
manualRowMove: [1, 2, 0]
|
99
99
|
});
|
100
100
|
|
101
|
-
expect(
|
102
|
-
expect(
|
103
|
-
expect(
|
101
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
|
102
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
|
103
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
104
104
|
|
105
105
|
updateSettings({
|
106
106
|
manualRowMove: void 0
|
107
107
|
});
|
108
108
|
|
109
|
-
expect(
|
110
|
-
expect(
|
111
|
-
expect(
|
109
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
110
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
111
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
112
112
|
});
|
113
113
|
|
114
|
-
it('should not change row order with updateSettings when `true` is passed',
|
114
|
+
it('should not change row order with updateSettings when `true` is passed', () => {
|
115
115
|
handsontable({
|
116
116
|
data: arrayOfObjects,
|
117
117
|
manualRowMove: [1, 2, 0]
|
118
118
|
});
|
119
119
|
|
120
|
-
expect(
|
121
|
-
expect(
|
122
|
-
expect(
|
120
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
|
121
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
|
122
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
123
123
|
|
124
124
|
updateSettings({
|
125
125
|
manualRowMove: true
|
126
126
|
});
|
127
127
|
|
128
|
-
expect(
|
129
|
-
expect(
|
130
|
-
expect(
|
128
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
|
129
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
|
130
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
|
131
131
|
});
|
132
132
|
});
|
133
133
|
|
134
134
|
describe('loadData', () => {
|
135
135
|
it('should increase numbers of rows if it is necessary', () => {
|
136
|
-
|
136
|
+
const hot = handsontable({
|
137
137
|
data: Handsontable.helper.createSpreadsheetData(5, 5),
|
138
138
|
manualRowMove: true
|
139
139
|
});
|
@@ -144,7 +144,7 @@ describe('manualRowMove', () => {
|
|
144
144
|
expect(hot.getPlugin('manualRowMove').rowsMapper.__arrayMap.length).toEqual(10);
|
145
145
|
});
|
146
146
|
it('should decrease numbers of rows if it is necessary', () => {
|
147
|
-
|
147
|
+
const hot = handsontable({
|
148
148
|
data: Handsontable.helper.createSpreadsheetData(5, 5),
|
149
149
|
manualRowMove: true
|
150
150
|
});
|
@@ -157,48 +157,48 @@ describe('manualRowMove', () => {
|
|
157
157
|
});
|
158
158
|
|
159
159
|
describe('moving', () => {
|
160
|
-
it('should move row by API',
|
161
|
-
|
160
|
+
it('should move row by API', () => {
|
161
|
+
const hot = handsontable({
|
162
162
|
data: arrayOfObjects,
|
163
163
|
rowHeaders: true,
|
164
164
|
manualRowMove: true
|
165
165
|
});
|
166
166
|
|
167
|
-
expect(
|
168
|
-
expect(
|
169
|
-
expect(
|
167
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
168
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
169
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
170
170
|
|
171
171
|
hot.getPlugin('manualRowMove').moveRow(2, 0);
|
172
172
|
hot.render();
|
173
173
|
|
174
|
-
expect(
|
175
|
-
expect(
|
176
|
-
expect(
|
174
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
|
175
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
|
176
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
|
177
177
|
});
|
178
178
|
|
179
|
-
it('should move many rows by API',
|
180
|
-
|
179
|
+
it('should move many rows by API', () => {
|
180
|
+
const hot = handsontable({
|
181
181
|
data: arrayOfObjects,
|
182
182
|
rowHeaders: true,
|
183
183
|
manualRowMove: true
|
184
184
|
});
|
185
185
|
|
186
|
-
expect(
|
187
|
-
expect(
|
188
|
-
expect(
|
186
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
187
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
188
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
189
189
|
|
190
190
|
hot.getPlugin('manualRowMove').moveRows([7, 9, 8], 0);
|
191
191
|
hot.render();
|
192
192
|
|
193
|
-
expect(
|
194
|
-
expect(
|
195
|
-
expect(
|
193
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('8');
|
194
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('10');
|
195
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('9');
|
196
196
|
});
|
197
197
|
|
198
|
-
it('should trigger the `beforeRowMove` hook before row move with visual indexes as parameters',
|
199
|
-
|
198
|
+
it('should trigger the `beforeRowMove` hook before row move with visual indexes as parameters', () => {
|
199
|
+
const beforeMoveRowCallback = jasmine.createSpy('beforeMoveRowCallback');
|
200
200
|
|
201
|
-
|
201
|
+
const hot = handsontable({
|
202
202
|
data: arrayOfObjects,
|
203
203
|
rowHeaders: true,
|
204
204
|
manualRowMove: true,
|
@@ -214,10 +214,10 @@ describe('manualRowMove', () => {
|
|
214
214
|
expect(beforeMoveRowCallback).toHaveBeenCalledWith([8, 9, 7], 0, void 0, void 0, void 0, void 0);
|
215
215
|
});
|
216
216
|
|
217
|
-
it('should trigger the `afterRowMove` hook after row move with visual indexes as parameters',
|
218
|
-
|
217
|
+
it('should trigger the `afterRowMove` hook after row move with visual indexes as parameters', () => {
|
218
|
+
const afterMoveRowCallback = jasmine.createSpy('afterMoveRowCallback');
|
219
219
|
|
220
|
-
|
220
|
+
const hot = handsontable({
|
221
221
|
data: arrayOfObjects,
|
222
222
|
rowHeaders: true,
|
223
223
|
manualRowMove: true,
|
@@ -233,18 +233,216 @@ describe('manualRowMove', () => {
|
|
233
233
|
expect(afterMoveRowCallback).toHaveBeenCalledWith([8, 9, 7], 0, void 0, void 0, void 0, void 0);
|
234
234
|
});
|
235
235
|
|
236
|
-
it('should
|
237
|
-
|
236
|
+
it('should run `beforeRowMove` with proper `target` parameter (moving row above first header)', () => {
|
237
|
+
let targetParameterInsideCallback;
|
238
|
+
|
239
|
+
handsontable({
|
240
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
241
|
+
rowHeaders: true,
|
242
|
+
colHeaders: true,
|
243
|
+
manualRowMove: true,
|
244
|
+
beforeRowMove: (rows, target) => {
|
245
|
+
targetParameterInsideCallback = target;
|
246
|
+
}
|
247
|
+
});
|
248
|
+
const $fistHeader = spec().$container.find('tbody tr:eq(0) th:eq(0)');
|
249
|
+
|
250
|
+
spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
|
251
|
+
spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
|
252
|
+
spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
|
253
|
+
|
254
|
+
$fistHeader.simulate('mouseover');
|
255
|
+
$fistHeader.simulate('mousemove', {
|
256
|
+
clientY: $fistHeader.offset().bottom - $fistHeader.height() - 50
|
257
|
+
});
|
258
|
+
$fistHeader.simulate('mouseup');
|
259
|
+
|
260
|
+
expect(targetParameterInsideCallback).toEqual(0);
|
261
|
+
});
|
262
|
+
|
263
|
+
it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of first header)', () => {
|
264
|
+
let targetParameterInsideCallback;
|
265
|
+
|
266
|
+
handsontable({
|
267
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
268
|
+
rowHeaders: true,
|
269
|
+
manualRowMove: true,
|
270
|
+
colHeaders: true,
|
271
|
+
beforeRowMove: (rows, target) => {
|
272
|
+
targetParameterInsideCallback = target;
|
273
|
+
}
|
274
|
+
});
|
275
|
+
const $fistHeader = spec().$container.find('tbody tr:eq(0) th:eq(0)');
|
276
|
+
|
277
|
+
spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
|
278
|
+
spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
|
279
|
+
spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
|
280
|
+
|
281
|
+
$fistHeader.simulate('mouseover');
|
282
|
+
$fistHeader.simulate('mousemove', {
|
283
|
+
clientY: $fistHeader.offset().bottom - $fistHeader.height()
|
284
|
+
});
|
285
|
+
$fistHeader.simulate('mouseup');
|
286
|
+
|
287
|
+
expect(targetParameterInsideCallback).toEqual(0);
|
288
|
+
});
|
289
|
+
|
290
|
+
it('should run `beforeRowMove` with proper `target` parameter (moving row to the middle of the table)', () => {
|
291
|
+
let targetParameterInsideCallback;
|
292
|
+
|
293
|
+
handsontable({
|
294
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
295
|
+
rowHeaders: true,
|
296
|
+
manualRowMove: true,
|
297
|
+
beforeRowMove: (rows, target) => {
|
298
|
+
targetParameterInsideCallback = target;
|
299
|
+
}
|
300
|
+
});
|
301
|
+
|
302
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
303
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
304
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
305
|
+
|
306
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
|
307
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
|
308
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
|
309
|
+
|
310
|
+
expect(targetParameterInsideCallback).toEqual(2);
|
311
|
+
});
|
312
|
+
|
313
|
+
it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of last header)', () => {
|
314
|
+
let targetParameterInsideCallback;
|
315
|
+
|
316
|
+
handsontable({
|
317
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
318
|
+
rowHeaders: true,
|
319
|
+
manualRowMove: true,
|
320
|
+
beforeRowMove: (rows, target) => {
|
321
|
+
targetParameterInsideCallback = target;
|
322
|
+
}
|
323
|
+
});
|
324
|
+
|
325
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
326
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
327
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
328
|
+
|
329
|
+
spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseover');
|
330
|
+
spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mousemove');
|
331
|
+
spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseup');
|
332
|
+
|
333
|
+
expect(targetParameterInsideCallback).toEqual(29);
|
334
|
+
});
|
335
|
+
|
336
|
+
it('should run `beforeRowMove` with proper `target` parameter (moving row to the bottom of last header)', () => {
|
337
|
+
let targetParameterInsideCallback;
|
338
|
+
|
339
|
+
handsontable({
|
340
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
341
|
+
rowHeaders: true,
|
342
|
+
manualRowMove: true,
|
343
|
+
beforeRowMove: (rows, target) => {
|
344
|
+
targetParameterInsideCallback = target;
|
345
|
+
}
|
346
|
+
});
|
347
|
+
const $lastHeader = spec().$container.find('tbody tr:eq(29) th:eq(0)');
|
348
|
+
|
349
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
350
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
351
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
352
|
+
|
353
|
+
$lastHeader.simulate('mouseover');
|
354
|
+
$lastHeader.simulate('mousemove', {
|
355
|
+
clientY: $lastHeader.offset().top + $lastHeader.height()
|
356
|
+
});
|
357
|
+
$lastHeader.simulate('mouseup');
|
358
|
+
|
359
|
+
expect(targetParameterInsideCallback).toEqual(30);
|
360
|
+
});
|
361
|
+
|
362
|
+
it('should run `beforeRowMove` with proper `target` parameter (moving row below last header)', () => {
|
363
|
+
let targetParameterInsideCallback;
|
364
|
+
|
365
|
+
handsontable({
|
366
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
367
|
+
rowHeaders: true,
|
368
|
+
manualRowMove: true,
|
369
|
+
beforeRowMove: (rows, target) => {
|
370
|
+
targetParameterInsideCallback = target;
|
371
|
+
}
|
372
|
+
});
|
373
|
+
const $lastHeader = spec().$container.find('tbody tr:eq(29) th:eq(0)');
|
374
|
+
|
375
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
376
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
377
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
378
|
+
|
379
|
+
$lastHeader.simulate('mouseover');
|
380
|
+
$lastHeader.simulate('mousemove', {
|
381
|
+
clientY: $lastHeader.offset().top + $lastHeader.height() + 200
|
382
|
+
});
|
383
|
+
$lastHeader.simulate('mouseup');
|
384
|
+
|
385
|
+
expect(targetParameterInsideCallback).toEqual(30);
|
386
|
+
});
|
387
|
+
|
388
|
+
it('should run `beforeRowMove` with proper visual `target` parameter', () => {
|
389
|
+
let targetParameterInsideCallback;
|
390
|
+
|
391
|
+
handsontable({
|
392
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
393
|
+
rowHeaders: true,
|
394
|
+
manualRowMove: [1, 2, 0],
|
395
|
+
beforeRowMove: (rows, target) => {
|
396
|
+
targetParameterInsideCallback = target;
|
397
|
+
}
|
398
|
+
});
|
399
|
+
|
400
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
401
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
402
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
403
|
+
|
404
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
|
405
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
|
406
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
|
407
|
+
|
408
|
+
expect(targetParameterInsideCallback).toEqual(2);
|
409
|
+
});
|
410
|
+
|
411
|
+
it('should run `afterRowMove` with proper visual `target` parameter', () => {
|
412
|
+
let targetParameterInsideCallback;
|
413
|
+
|
414
|
+
handsontable({
|
415
|
+
data: Handsontable.helper.createSpreadsheetData(30, 30),
|
416
|
+
rowHeaders: true,
|
417
|
+
manualRowMove: [1, 2, 0],
|
418
|
+
afterRowMove: (rows, target) => {
|
419
|
+
targetParameterInsideCallback = target;
|
420
|
+
}
|
421
|
+
});
|
422
|
+
|
423
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
424
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
|
425
|
+
spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
|
426
|
+
|
427
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
|
428
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
|
429
|
+
spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
|
430
|
+
|
431
|
+
expect(targetParameterInsideCallback).toEqual(2);
|
432
|
+
});
|
433
|
+
|
434
|
+
it('should move the second row to the first row', () => {
|
435
|
+
handsontable({
|
238
436
|
data: arrayOfObjects,
|
239
437
|
rowHeaders: true,
|
240
438
|
manualRowMove: true
|
241
439
|
});
|
242
440
|
|
243
|
-
expect(
|
244
|
-
expect(
|
245
|
-
expect(
|
441
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
442
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
443
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
246
444
|
|
247
|
-
|
445
|
+
const $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
|
248
446
|
|
249
447
|
$rowsHeaders.eq(1).simulate('mousedown');
|
250
448
|
$rowsHeaders.eq(1).simulate('mouseup');
|
@@ -253,23 +451,23 @@ describe('manualRowMove', () => {
|
|
253
451
|
$rowsHeaders.eq(0).simulate('mousemove');
|
254
452
|
$rowsHeaders.eq(0).simulate('mouseup');
|
255
453
|
|
256
|
-
expect(
|
257
|
-
expect(
|
258
|
-
expect(
|
454
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
|
455
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
|
456
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
259
457
|
});
|
260
458
|
|
261
|
-
it('should move the second row to the third row',
|
459
|
+
it('should move the second row to the third row', () => {
|
262
460
|
handsontable({
|
263
461
|
data: arrayOfObjects,
|
264
462
|
rowHeaders: true,
|
265
463
|
manualRowMove: true
|
266
464
|
});
|
267
465
|
|
268
|
-
expect(
|
269
|
-
expect(
|
270
|
-
expect(
|
466
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
467
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
|
468
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
|
271
469
|
|
272
|
-
|
470
|
+
const $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
|
273
471
|
|
274
472
|
$rowsHeaders.eq(1).simulate('mousedown');
|
275
473
|
$rowsHeaders.eq(1).simulate('mouseup');
|
@@ -278,13 +476,13 @@ describe('manualRowMove', () => {
|
|
278
476
|
$rowsHeaders.eq(3).simulate('mousemove');
|
279
477
|
$rowsHeaders.eq(3).simulate('mouseup');
|
280
478
|
|
281
|
-
expect(
|
282
|
-
expect(
|
283
|
-
expect(
|
479
|
+
expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
|
480
|
+
expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
|
481
|
+
expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
|
284
482
|
});
|
285
483
|
|
286
|
-
it('should not move row if it\'s not needed',
|
287
|
-
|
484
|
+
it('should not move row if it\'s not needed', () => {
|
485
|
+
let cache = [];
|
288
486
|
|
289
487
|
handsontable({
|
290
488
|
data: arrayOfObjects,
|
@@ -295,7 +493,7 @@ describe('manualRowMove', () => {
|
|
295
493
|
}
|
296
494
|
});
|
297
495
|
|
298
|
-
|
496
|
+
const $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
|
299
497
|
|
300
498
|
$rowsHeaders.eq(1).simulate('mousedown');
|
301
499
|
$rowsHeaders.eq(1).simulate('mouseup');
|
@@ -306,7 +504,7 @@ describe('manualRowMove', () => {
|
|
306
504
|
});
|
307
505
|
|
308
506
|
it('should properly scrolling viewport if mouse is over part-visible cell', (done) => {
|
309
|
-
|
507
|
+
const hot = handsontable({
|
310
508
|
data: Handsontable.helper.createSpreadsheetData(20, 20),
|
311
509
|
colHeaders: true,
|
312
510
|
rowHeaders: true,
|
@@ -316,14 +514,12 @@ describe('manualRowMove', () => {
|
|
316
514
|
rowHeights: 47
|
317
515
|
});
|
318
516
|
|
319
|
-
var ev = {};
|
320
|
-
|
321
517
|
hot.selectCell(19, 0);
|
322
518
|
|
323
519
|
setTimeout(() => {
|
324
520
|
expect(hot.view.wt.wtTable.getFirstVisibleRow()).toBeGreaterThan(8);
|
325
521
|
|
326
|
-
|
522
|
+
const $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
|
327
523
|
|
328
524
|
$rowsHeaders.eq(10).simulate('mousedown');
|
329
525
|
$rowsHeaders.eq(10).simulate('mouseup');
|
@@ -340,7 +536,7 @@ describe('manualRowMove', () => {
|
|
340
536
|
});
|
341
537
|
|
342
538
|
it('moving row should keep cell meta created using cells function', () => {
|
343
|
-
|
539
|
+
const hot = handsontable({
|
344
540
|
data: arrayOfObjects,
|
345
541
|
rowHeaders: true,
|
346
542
|
manualRowMove: true,
|
@@ -351,7 +547,7 @@ describe('manualRowMove', () => {
|
|
351
547
|
}
|
352
548
|
});
|
353
549
|
|
354
|
-
|
550
|
+
const htCore = getHtCore();
|
355
551
|
|
356
552
|
expect(htCore.find('tbody tr:eq(1) td:eq(0)')[0].className.indexOf('htDimmed')).toBeGreaterThan(-1);
|
357
553
|
|