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.

Files changed (95) hide show
  1. package/.travis.yml +2 -0
  2. package/README.md +127 -96
  3. package/commonjs/core.js +11 -6
  4. package/commonjs/helpers/dom/element.js +4 -3
  5. package/commonjs/helpers/mixed.js +8 -4
  6. package/commonjs/index.js +5 -4
  7. package/commonjs/pluginHooks.js +18 -2
  8. package/commonjs/plugins/copyPaste/clipboardData.js +31 -0
  9. package/commonjs/plugins/copyPaste/contextMenuItem/copy.js +1 -2
  10. package/commonjs/plugins/copyPaste/contextMenuItem/cut.js +1 -2
  11. package/commonjs/plugins/copyPaste/copyPaste.js +127 -134
  12. package/commonjs/plugins/copyPaste/pasteEvent.js +19 -0
  13. package/commonjs/plugins/copyPaste/test/copyPaste.e2e.js +90 -189
  14. package/commonjs/plugins/copyPaste/test/textarea.unit.js +2 -2
  15. package/commonjs/plugins/copyPaste/textarea.js +2 -1
  16. package/commonjs/plugins/manualColumnMove/manualColumnMove.js +8 -11
  17. package/commonjs/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
  18. package/commonjs/plugins/manualRowMove/manualRowMove.js +9 -12
  19. package/commonjs/plugins/manualRowMove/test/manualRowMove.e2e.js +256 -60
  20. package/commonjs/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +40 -182
  21. package/commonjs/plugins/manualRowMove/ui/_base.js +2 -2
  22. package/commonjs/tableView.js +1 -0
  23. package/dist/handsontable.css +6 -5
  24. package/dist/handsontable.css.map +1 -1
  25. package/dist/handsontable.full.css +6 -5
  26. package/dist/handsontable.full.js +37721 -42290
  27. package/dist/handsontable.full.min.css +4 -4
  28. package/dist/handsontable.full.min.js +5 -5
  29. package/dist/handsontable.js +28732 -28433
  30. package/dist/handsontable.js.map +1 -1
  31. package/dist/handsontable.min.css +4 -4
  32. package/dist/handsontable.min.js +3 -3
  33. package/es/core.js +11 -6
  34. package/es/helpers/dom/element.js +4 -3
  35. package/es/helpers/mixed.js +4 -4
  36. package/es/index.js +3 -4
  37. package/es/pluginHooks.js +18 -2
  38. package/es/plugins/copyPaste/clipboardData.js +27 -0
  39. package/es/plugins/copyPaste/contextMenuItem/copy.js +1 -2
  40. package/es/plugins/copyPaste/contextMenuItem/cut.js +1 -2
  41. package/es/plugins/copyPaste/copyPaste.js +124 -132
  42. package/es/plugins/copyPaste/pasteEvent.js +11 -0
  43. package/es/plugins/copyPaste/test/copyPaste.e2e.js +90 -189
  44. package/es/plugins/copyPaste/test/textarea.unit.js +2 -2
  45. package/es/plugins/copyPaste/textarea.js +2 -1
  46. package/es/plugins/manualColumnMove/manualColumnMove.js +8 -11
  47. package/es/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
  48. package/es/plugins/manualRowMove/manualRowMove.js +9 -12
  49. package/es/plugins/manualRowMove/test/manualRowMove.e2e.js +256 -60
  50. package/es/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +40 -182
  51. package/es/plugins/manualRowMove/ui/_base.js +2 -2
  52. package/es/tableView.js +1 -0
  53. package/handsontable.jquery.json +1 -1
  54. package/hot.config.js +1 -1
  55. package/package.json +5 -5
  56. package/src/3rdparty/walkontable/dist/walkontable.js +27234 -11175
  57. package/src/3rdparty/walkontable/dist/walkontable.js.map +1 -1
  58. package/src/3rdparty/walkontable/test/dist/helpers.entry.js +32 -36
  59. package/src/3rdparty/walkontable/test/dist/helpers.entry.js.map +1 -1
  60. package/src/3rdparty/walkontable/test/dist/specs.entry.js +36 -39
  61. package/src/3rdparty/walkontable/test/dist/specs.entry.js.map +1 -1
  62. package/src/core.js +11 -6
  63. package/src/css/handsontable.css +1 -2
  64. package/src/helpers/dom/element.js +4 -3
  65. package/src/helpers/mixed.js +3 -3
  66. package/src/index.js +1 -2
  67. package/src/pluginHooks.js +18 -2
  68. package/src/plugins/copyPaste/clipboardData.js +11 -0
  69. package/src/plugins/copyPaste/contextMenuItem/copy.js +1 -2
  70. package/src/plugins/copyPaste/contextMenuItem/cut.js +1 -2
  71. package/src/plugins/copyPaste/copyPaste.css +3 -1
  72. package/src/plugins/copyPaste/copyPaste.js +120 -127
  73. package/src/plugins/copyPaste/pasteEvent.js +7 -0
  74. package/src/plugins/copyPaste/test/copyPaste.e2e.js +75 -193
  75. package/src/plugins/copyPaste/test/textarea.unit.js +2 -2
  76. package/src/plugins/copyPaste/textarea.js +2 -1
  77. package/src/plugins/manualColumnMove/manualColumnMove.js +6 -9
  78. package/src/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
  79. package/src/plugins/manualRowMove/manualRowMove.js +7 -10
  80. package/src/plugins/manualRowMove/test/manualRowMove.e2e.js +282 -86
  81. package/src/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +51 -190
  82. package/src/plugins/manualRowMove/ui/_base.js +2 -2
  83. package/test/dist/e2e.entry.js +31381 -31131
  84. package/test/dist/e2e.entry.js.map +1 -1
  85. package/test/dist/helpers.entry.js +16 -19
  86. package/test/dist/helpers.entry.js.map +1 -1
  87. package/test/e2e/Core_listen.spec.js +32 -0
  88. package/test/e2e/Core_selection.spec.js +1 -1
  89. package/test/e2e/Core_validate.spec.js +29 -0
  90. package/test/e2e/renderers/checkboxRenderer.spec.js +20 -7
  91. package/test/e2e/settings/fragmentSelection.spec.js +12 -9
  92. package/test/scripts/trigger-pro-tests.sh +41 -0
  93. package/yarn.lock +260 -208
  94. package/.npmignore +0 -19
  95. package/demo/bower_components/numbro/package.json +0 -63
@@ -20,9 +20,9 @@ describe('manualRowMove', function () {
20
20
  manualRowMove: [1, 2, 0]
21
21
  });
22
22
 
23
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
24
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
25
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
23
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
24
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
25
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
26
26
  });
27
27
  });
28
28
 
@@ -37,10 +37,10 @@ describe('manualRowMove', function () {
37
37
  manualRowMove: true
38
38
  });
39
39
 
40
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
41
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
40
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
41
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
42
42
 
43
- expect(this.$container.hasClass('after-selection--rows')).toBeGreaterThan(0);
43
+ expect(spec().$container.hasClass('after-selection--rows')).toBeGreaterThan(0);
44
44
  });
45
45
 
46
46
  it('should change the default row order with updateSettings', function () {
@@ -49,17 +49,17 @@ describe('manualRowMove', function () {
49
49
  manualRowMove: true
50
50
  });
51
51
 
52
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
53
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
54
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
52
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
53
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
54
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
55
55
 
56
56
  updateSettings({
57
57
  manualRowMove: [2, 1, 0]
58
58
  });
59
59
 
60
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
61
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
62
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
60
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
61
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
62
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
63
63
  });
64
64
 
65
65
  it('should change row order with updateSettings', function () {
@@ -68,17 +68,17 @@ describe('manualRowMove', function () {
68
68
  manualRowMove: [1, 2, 0]
69
69
  });
70
70
 
71
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
72
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
73
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
71
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
72
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
73
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
74
74
 
75
75
  updateSettings({
76
76
  manualRowMove: [2, 1, 0]
77
77
  });
78
78
 
79
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
80
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
81
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
79
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
80
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
81
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
82
82
  });
83
83
 
84
84
  it('should reset row order with updateSettings when undefined is passed', function () {
@@ -87,17 +87,17 @@ describe('manualRowMove', function () {
87
87
  manualRowMove: [1, 2, 0]
88
88
  });
89
89
 
90
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
91
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
92
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
90
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
91
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
92
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
93
93
 
94
94
  updateSettings({
95
95
  manualRowMove: void 0
96
96
  });
97
97
 
98
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
99
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
100
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
98
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
99
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
100
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
101
101
  });
102
102
 
103
103
  it('should not change row order with updateSettings when `true` is passed', function () {
@@ -106,17 +106,17 @@ describe('manualRowMove', function () {
106
106
  manualRowMove: [1, 2, 0]
107
107
  });
108
108
 
109
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
110
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
111
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
109
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
110
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
111
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
112
112
 
113
113
  updateSettings({
114
114
  manualRowMove: true
115
115
  });
116
116
 
117
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
118
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
119
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
117
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
118
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
119
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
120
120
  });
121
121
  });
122
122
 
@@ -153,16 +153,16 @@ describe('manualRowMove', function () {
153
153
  manualRowMove: true
154
154
  });
155
155
 
156
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
157
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
158
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
156
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
157
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
158
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
159
159
 
160
160
  hot.getPlugin('manualRowMove').moveRow(2, 0);
161
161
  hot.render();
162
162
 
163
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
164
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
165
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
163
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
164
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
165
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
166
166
  });
167
167
 
168
168
  it('should move many rows by API', function () {
@@ -172,16 +172,16 @@ describe('manualRowMove', function () {
172
172
  manualRowMove: true
173
173
  });
174
174
 
175
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
176
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
177
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
175
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
176
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
177
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
178
178
 
179
179
  hot.getPlugin('manualRowMove').moveRows([7, 9, 8], 0);
180
180
  hot.render();
181
181
 
182
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('8');
183
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('10');
184
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('9');
182
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('8');
183
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('10');
184
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('9');
185
185
  });
186
186
 
187
187
  it('should trigger the `beforeRowMove` hook before row move with visual indexes as parameters', function () {
@@ -222,18 +222,216 @@ describe('manualRowMove', function () {
222
222
  expect(afterMoveRowCallback).toHaveBeenCalledWith([8, 9, 7], 0, void 0, void 0, void 0, void 0);
223
223
  });
224
224
 
225
+ it('should run `beforeRowMove` with proper `target` parameter (moving row above first header)', function () {
226
+ var targetParameterInsideCallback = void 0;
227
+
228
+ handsontable({
229
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
230
+ rowHeaders: true,
231
+ colHeaders: true,
232
+ manualRowMove: true,
233
+ beforeRowMove: function beforeRowMove(rows, target) {
234
+ targetParameterInsideCallback = target;
235
+ }
236
+ });
237
+ var $fistHeader = spec().$container.find('tbody tr:eq(0) th:eq(0)');
238
+
239
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
240
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
241
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
242
+
243
+ $fistHeader.simulate('mouseover');
244
+ $fistHeader.simulate('mousemove', {
245
+ clientY: $fistHeader.offset().bottom - $fistHeader.height() - 50
246
+ });
247
+ $fistHeader.simulate('mouseup');
248
+
249
+ expect(targetParameterInsideCallback).toEqual(0);
250
+ });
251
+
252
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of first header)', function () {
253
+ var targetParameterInsideCallback = void 0;
254
+
255
+ handsontable({
256
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
257
+ rowHeaders: true,
258
+ manualRowMove: true,
259
+ colHeaders: true,
260
+ beforeRowMove: function beforeRowMove(rows, target) {
261
+ targetParameterInsideCallback = target;
262
+ }
263
+ });
264
+ var $fistHeader = spec().$container.find('tbody tr:eq(0) th:eq(0)');
265
+
266
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
267
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
268
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
269
+
270
+ $fistHeader.simulate('mouseover');
271
+ $fistHeader.simulate('mousemove', {
272
+ clientY: $fistHeader.offset().bottom - $fistHeader.height()
273
+ });
274
+ $fistHeader.simulate('mouseup');
275
+
276
+ expect(targetParameterInsideCallback).toEqual(0);
277
+ });
278
+
279
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the middle of the table)', function () {
280
+ var targetParameterInsideCallback = void 0;
281
+
282
+ handsontable({
283
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
284
+ rowHeaders: true,
285
+ manualRowMove: true,
286
+ beforeRowMove: function beforeRowMove(rows, target) {
287
+ targetParameterInsideCallback = target;
288
+ }
289
+ });
290
+
291
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
292
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
293
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
294
+
295
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
296
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
297
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
298
+
299
+ expect(targetParameterInsideCallback).toEqual(2);
300
+ });
301
+
302
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of last header)', function () {
303
+ var targetParameterInsideCallback = void 0;
304
+
305
+ handsontable({
306
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
307
+ rowHeaders: true,
308
+ manualRowMove: true,
309
+ beforeRowMove: function beforeRowMove(rows, target) {
310
+ targetParameterInsideCallback = target;
311
+ }
312
+ });
313
+
314
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
315
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
316
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
317
+
318
+ spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseover');
319
+ spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mousemove');
320
+ spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseup');
321
+
322
+ expect(targetParameterInsideCallback).toEqual(29);
323
+ });
324
+
325
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the bottom of last header)', function () {
326
+ var targetParameterInsideCallback = void 0;
327
+
328
+ handsontable({
329
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
330
+ rowHeaders: true,
331
+ manualRowMove: true,
332
+ beforeRowMove: function beforeRowMove(rows, target) {
333
+ targetParameterInsideCallback = target;
334
+ }
335
+ });
336
+ var $lastHeader = spec().$container.find('tbody tr:eq(29) th:eq(0)');
337
+
338
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
339
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
340
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
341
+
342
+ $lastHeader.simulate('mouseover');
343
+ $lastHeader.simulate('mousemove', {
344
+ clientY: $lastHeader.offset().top + $lastHeader.height()
345
+ });
346
+ $lastHeader.simulate('mouseup');
347
+
348
+ expect(targetParameterInsideCallback).toEqual(30);
349
+ });
350
+
351
+ it('should run `beforeRowMove` with proper `target` parameter (moving row below last header)', function () {
352
+ var targetParameterInsideCallback = void 0;
353
+
354
+ handsontable({
355
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
356
+ rowHeaders: true,
357
+ manualRowMove: true,
358
+ beforeRowMove: function beforeRowMove(rows, target) {
359
+ targetParameterInsideCallback = target;
360
+ }
361
+ });
362
+ var $lastHeader = spec().$container.find('tbody tr:eq(29) th:eq(0)');
363
+
364
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
365
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
366
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
367
+
368
+ $lastHeader.simulate('mouseover');
369
+ $lastHeader.simulate('mousemove', {
370
+ clientY: $lastHeader.offset().top + $lastHeader.height() + 200
371
+ });
372
+ $lastHeader.simulate('mouseup');
373
+
374
+ expect(targetParameterInsideCallback).toEqual(30);
375
+ });
376
+
377
+ it('should run `beforeRowMove` with proper visual `target` parameter', function () {
378
+ var targetParameterInsideCallback = void 0;
379
+
380
+ handsontable({
381
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
382
+ rowHeaders: true,
383
+ manualRowMove: [1, 2, 0],
384
+ beforeRowMove: function beforeRowMove(rows, target) {
385
+ targetParameterInsideCallback = target;
386
+ }
387
+ });
388
+
389
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
390
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
391
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
392
+
393
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
394
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
395
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
396
+
397
+ expect(targetParameterInsideCallback).toEqual(2);
398
+ });
399
+
400
+ it('should run `afterRowMove` with proper visual `target` parameter', function () {
401
+ var targetParameterInsideCallback = void 0;
402
+
403
+ handsontable({
404
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
405
+ rowHeaders: true,
406
+ manualRowMove: [1, 2, 0],
407
+ afterRowMove: function afterRowMove(rows, target) {
408
+ targetParameterInsideCallback = target;
409
+ }
410
+ });
411
+
412
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
413
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
414
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
415
+
416
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
417
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
418
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
419
+
420
+ expect(targetParameterInsideCallback).toEqual(2);
421
+ });
422
+
225
423
  it('should move the second row to the first row', function () {
226
- var hot = handsontable({
424
+ handsontable({
227
425
  data: arrayOfObjects,
228
426
  rowHeaders: true,
229
427
  manualRowMove: true
230
428
  });
231
429
 
232
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
233
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
234
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
430
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
431
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
432
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
235
433
 
236
- var $rowsHeaders = this.$container.find('.ht_clone_left tr th');
434
+ var $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
237
435
 
238
436
  $rowsHeaders.eq(1).simulate('mousedown');
239
437
  $rowsHeaders.eq(1).simulate('mouseup');
@@ -242,9 +440,9 @@ describe('manualRowMove', function () {
242
440
  $rowsHeaders.eq(0).simulate('mousemove');
243
441
  $rowsHeaders.eq(0).simulate('mouseup');
244
442
 
245
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
246
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
247
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
443
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
444
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
445
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
248
446
  });
249
447
 
250
448
  it('should move the second row to the third row', function () {
@@ -254,11 +452,11 @@ describe('manualRowMove', function () {
254
452
  manualRowMove: true
255
453
  });
256
454
 
257
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
258
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
259
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
455
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
456
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
457
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
260
458
 
261
- var $rowsHeaders = this.$container.find('.ht_clone_left tr th');
459
+ var $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
262
460
 
263
461
  $rowsHeaders.eq(1).simulate('mousedown');
264
462
  $rowsHeaders.eq(1).simulate('mouseup');
@@ -267,9 +465,9 @@ describe('manualRowMove', function () {
267
465
  $rowsHeaders.eq(3).simulate('mousemove');
268
466
  $rowsHeaders.eq(3).simulate('mouseup');
269
467
 
270
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
271
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
272
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
468
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
469
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
470
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
273
471
  });
274
472
 
275
473
  it('should not move row if it\'s not needed', function () {
@@ -284,7 +482,7 @@ describe('manualRowMove', function () {
284
482
  }
285
483
  });
286
484
 
287
- var $rowsHeaders = this.$container.find('.ht_clone_left tr th');
485
+ var $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
288
486
 
289
487
  $rowsHeaders.eq(1).simulate('mousedown');
290
488
  $rowsHeaders.eq(1).simulate('mouseup');
@@ -305,8 +503,6 @@ describe('manualRowMove', function () {
305
503
  rowHeights: 47
306
504
  });
307
505
 
308
- var ev = {};
309
-
310
506
  hot.selectCell(19, 0);
311
507
 
312
508
  setTimeout(function () {