handsontable 0.34.1 → 0.34.5

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.

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
@@ -22,9 +22,9 @@ describe('manualRowMove', function () {
22
22
  manualRowMove: [1, 2, 0]
23
23
  });
24
24
 
25
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
26
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
27
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
25
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
26
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
27
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
28
28
  });
29
29
  });
30
30
 
@@ -39,10 +39,10 @@ describe('manualRowMove', function () {
39
39
  manualRowMove: true
40
40
  });
41
41
 
42
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
43
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
42
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
43
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
44
44
 
45
- expect(this.$container.hasClass('after-selection--rows')).toBeGreaterThan(0);
45
+ expect(spec().$container.hasClass('after-selection--rows')).toBeGreaterThan(0);
46
46
  });
47
47
 
48
48
  it('should change the default row order with updateSettings', function () {
@@ -51,17 +51,17 @@ describe('manualRowMove', function () {
51
51
  manualRowMove: true
52
52
  });
53
53
 
54
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
55
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
56
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
54
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
55
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
56
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
57
57
 
58
58
  updateSettings({
59
59
  manualRowMove: [2, 1, 0]
60
60
  });
61
61
 
62
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
63
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
64
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
62
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
63
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
64
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
65
65
  });
66
66
 
67
67
  it('should change row order with updateSettings', function () {
@@ -70,17 +70,17 @@ describe('manualRowMove', function () {
70
70
  manualRowMove: [1, 2, 0]
71
71
  });
72
72
 
73
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
74
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
75
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
73
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
74
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
75
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
76
76
 
77
77
  updateSettings({
78
78
  manualRowMove: [2, 1, 0]
79
79
  });
80
80
 
81
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
82
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
83
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
81
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
82
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
83
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
84
84
  });
85
85
 
86
86
  it('should reset row order with updateSettings when undefined is passed', function () {
@@ -89,17 +89,17 @@ describe('manualRowMove', function () {
89
89
  manualRowMove: [1, 2, 0]
90
90
  });
91
91
 
92
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
93
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
94
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
92
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
93
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
94
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
95
95
 
96
96
  updateSettings({
97
97
  manualRowMove: void 0
98
98
  });
99
99
 
100
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
101
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
102
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
100
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
101
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
102
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
103
103
  });
104
104
 
105
105
  it('should not change row order with updateSettings when `true` is passed', function () {
@@ -108,17 +108,17 @@ describe('manualRowMove', function () {
108
108
  manualRowMove: [1, 2, 0]
109
109
  });
110
110
 
111
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
112
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
113
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
111
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
112
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
113
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
114
114
 
115
115
  updateSettings({
116
116
  manualRowMove: true
117
117
  });
118
118
 
119
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
120
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
121
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
119
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
120
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
121
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('1');
122
122
  });
123
123
  });
124
124
 
@@ -155,16 +155,16 @@ describe('manualRowMove', function () {
155
155
  manualRowMove: true
156
156
  });
157
157
 
158
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
159
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
160
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
158
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
159
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
160
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
161
161
 
162
162
  hot.getPlugin('manualRowMove').moveRow(2, 0);
163
163
  hot.render();
164
164
 
165
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
166
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
167
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
165
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('3');
166
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
167
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
168
168
  });
169
169
 
170
170
  it('should move many rows by API', function () {
@@ -174,16 +174,16 @@ describe('manualRowMove', function () {
174
174
  manualRowMove: true
175
175
  });
176
176
 
177
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
178
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
179
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
177
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
178
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
179
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
180
180
 
181
181
  hot.getPlugin('manualRowMove').moveRows([7, 9, 8], 0);
182
182
  hot.render();
183
183
 
184
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('8');
185
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('10');
186
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('9');
184
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('8');
185
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('10');
186
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('9');
187
187
  });
188
188
 
189
189
  it('should trigger the `beforeRowMove` hook before row move with visual indexes as parameters', function () {
@@ -224,18 +224,216 @@ describe('manualRowMove', function () {
224
224
  expect(afterMoveRowCallback).toHaveBeenCalledWith([8, 9, 7], 0, void 0, void 0, void 0, void 0);
225
225
  });
226
226
 
227
+ it('should run `beforeRowMove` with proper `target` parameter (moving row above first header)', function () {
228
+ var targetParameterInsideCallback = void 0;
229
+
230
+ handsontable({
231
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
232
+ rowHeaders: true,
233
+ colHeaders: true,
234
+ manualRowMove: true,
235
+ beforeRowMove: function beforeRowMove(rows, target) {
236
+ targetParameterInsideCallback = target;
237
+ }
238
+ });
239
+ var $fistHeader = spec().$container.find('tbody tr:eq(0) th:eq(0)');
240
+
241
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
242
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
243
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
244
+
245
+ $fistHeader.simulate('mouseover');
246
+ $fistHeader.simulate('mousemove', {
247
+ clientY: $fistHeader.offset().bottom - $fistHeader.height() - 50
248
+ });
249
+ $fistHeader.simulate('mouseup');
250
+
251
+ expect(targetParameterInsideCallback).toEqual(0);
252
+ });
253
+
254
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of first header)', function () {
255
+ var targetParameterInsideCallback = void 0;
256
+
257
+ handsontable({
258
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
259
+ rowHeaders: true,
260
+ manualRowMove: true,
261
+ colHeaders: true,
262
+ beforeRowMove: function beforeRowMove(rows, target) {
263
+ targetParameterInsideCallback = target;
264
+ }
265
+ });
266
+ var $fistHeader = spec().$container.find('tbody tr:eq(0) th:eq(0)');
267
+
268
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
269
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
270
+ spec().$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
271
+
272
+ $fistHeader.simulate('mouseover');
273
+ $fistHeader.simulate('mousemove', {
274
+ clientY: $fistHeader.offset().bottom - $fistHeader.height()
275
+ });
276
+ $fistHeader.simulate('mouseup');
277
+
278
+ expect(targetParameterInsideCallback).toEqual(0);
279
+ });
280
+
281
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the middle of the table)', function () {
282
+ var targetParameterInsideCallback = void 0;
283
+
284
+ handsontable({
285
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
286
+ rowHeaders: true,
287
+ manualRowMove: true,
288
+ beforeRowMove: function beforeRowMove(rows, target) {
289
+ targetParameterInsideCallback = target;
290
+ }
291
+ });
292
+
293
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
294
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
295
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
296
+
297
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
298
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
299
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
300
+
301
+ expect(targetParameterInsideCallback).toEqual(2);
302
+ });
303
+
304
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of last header)', function () {
305
+ var targetParameterInsideCallback = void 0;
306
+
307
+ handsontable({
308
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
309
+ rowHeaders: true,
310
+ manualRowMove: true,
311
+ beforeRowMove: function beforeRowMove(rows, target) {
312
+ targetParameterInsideCallback = target;
313
+ }
314
+ });
315
+
316
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
317
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
318
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
319
+
320
+ spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseover');
321
+ spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mousemove');
322
+ spec().$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseup');
323
+
324
+ expect(targetParameterInsideCallback).toEqual(29);
325
+ });
326
+
327
+ it('should run `beforeRowMove` with proper `target` parameter (moving row to the bottom of last header)', function () {
328
+ var targetParameterInsideCallback = void 0;
329
+
330
+ handsontable({
331
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
332
+ rowHeaders: true,
333
+ manualRowMove: true,
334
+ beforeRowMove: function beforeRowMove(rows, target) {
335
+ targetParameterInsideCallback = target;
336
+ }
337
+ });
338
+ var $lastHeader = spec().$container.find('tbody tr:eq(29) th:eq(0)');
339
+
340
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
341
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
342
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
343
+
344
+ $lastHeader.simulate('mouseover');
345
+ $lastHeader.simulate('mousemove', {
346
+ clientY: $lastHeader.offset().top + $lastHeader.height()
347
+ });
348
+ $lastHeader.simulate('mouseup');
349
+
350
+ expect(targetParameterInsideCallback).toEqual(30);
351
+ });
352
+
353
+ it('should run `beforeRowMove` with proper `target` parameter (moving row below last header)', function () {
354
+ var targetParameterInsideCallback = void 0;
355
+
356
+ handsontable({
357
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
358
+ rowHeaders: true,
359
+ manualRowMove: true,
360
+ beforeRowMove: function beforeRowMove(rows, target) {
361
+ targetParameterInsideCallback = target;
362
+ }
363
+ });
364
+ var $lastHeader = spec().$container.find('tbody tr:eq(29) th:eq(0)');
365
+
366
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
367
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
368
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
369
+
370
+ $lastHeader.simulate('mouseover');
371
+ $lastHeader.simulate('mousemove', {
372
+ clientY: $lastHeader.offset().top + $lastHeader.height() + 200
373
+ });
374
+ $lastHeader.simulate('mouseup');
375
+
376
+ expect(targetParameterInsideCallback).toEqual(30);
377
+ });
378
+
379
+ it('should run `beforeRowMove` with proper visual `target` parameter', function () {
380
+ var targetParameterInsideCallback = void 0;
381
+
382
+ handsontable({
383
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
384
+ rowHeaders: true,
385
+ manualRowMove: [1, 2, 0],
386
+ beforeRowMove: function beforeRowMove(rows, target) {
387
+ targetParameterInsideCallback = target;
388
+ }
389
+ });
390
+
391
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
392
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
393
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
394
+
395
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
396
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
397
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
398
+
399
+ expect(targetParameterInsideCallback).toEqual(2);
400
+ });
401
+
402
+ it('should run `afterRowMove` with proper visual `target` parameter', function () {
403
+ var targetParameterInsideCallback = void 0;
404
+
405
+ handsontable({
406
+ data: Handsontable.helper.createSpreadsheetData(30, 30),
407
+ rowHeaders: true,
408
+ manualRowMove: [1, 2, 0],
409
+ afterRowMove: function afterRowMove(rows, target) {
410
+ targetParameterInsideCallback = target;
411
+ }
412
+ });
413
+
414
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
415
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
416
+ spec().$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
417
+
418
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
419
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
420
+ spec().$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
421
+
422
+ expect(targetParameterInsideCallback).toEqual(2);
423
+ });
424
+
227
425
  it('should move the second row to the first row', function () {
228
- var hot = handsontable({
426
+ handsontable({
229
427
  data: arrayOfObjects,
230
428
  rowHeaders: true,
231
429
  manualRowMove: true
232
430
  });
233
431
 
234
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
235
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
236
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
432
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
433
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
434
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
237
435
 
238
- var $rowsHeaders = this.$container.find('.ht_clone_left tr th');
436
+ var $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
239
437
 
240
438
  $rowsHeaders.eq(1).simulate('mousedown');
241
439
  $rowsHeaders.eq(1).simulate('mouseup');
@@ -244,9 +442,9 @@ describe('manualRowMove', function () {
244
442
  $rowsHeaders.eq(0).simulate('mousemove');
245
443
  $rowsHeaders.eq(0).simulate('mouseup');
246
444
 
247
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
248
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
249
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
445
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('2');
446
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('1');
447
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
250
448
  });
251
449
 
252
450
  it('should move the second row to the third row', function () {
@@ -256,11 +454,11 @@ describe('manualRowMove', function () {
256
454
  manualRowMove: true
257
455
  });
258
456
 
259
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
260
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
261
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
457
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
458
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('2');
459
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('3');
262
460
 
263
- var $rowsHeaders = this.$container.find('.ht_clone_left tr th');
461
+ var $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
264
462
 
265
463
  $rowsHeaders.eq(1).simulate('mousedown');
266
464
  $rowsHeaders.eq(1).simulate('mouseup');
@@ -269,9 +467,9 @@ describe('manualRowMove', function () {
269
467
  $rowsHeaders.eq(3).simulate('mousemove');
270
468
  $rowsHeaders.eq(3).simulate('mouseup');
271
469
 
272
- expect(this.$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
273
- expect(this.$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
274
- expect(this.$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
470
+ expect(spec().$container.find('tbody tr:eq(0) td:eq(0)').text()).toEqual('1');
471
+ expect(spec().$container.find('tbody tr:eq(1) td:eq(0)').text()).toEqual('3');
472
+ expect(spec().$container.find('tbody tr:eq(2) td:eq(0)').text()).toEqual('2');
275
473
  });
276
474
 
277
475
  it('should not move row if it\'s not needed', function () {
@@ -286,7 +484,7 @@ describe('manualRowMove', function () {
286
484
  }
287
485
  });
288
486
 
289
- var $rowsHeaders = this.$container.find('.ht_clone_left tr th');
487
+ var $rowsHeaders = spec().$container.find('.ht_clone_left tr th');
290
488
 
291
489
  $rowsHeaders.eq(1).simulate('mousedown');
292
490
  $rowsHeaders.eq(1).simulate('mouseup');
@@ -307,8 +505,6 @@ describe('manualRowMove', function () {
307
505
  rowHeights: 47
308
506
  });
309
507
 
310
- var ev = {};
311
-
312
508
  hot.selectCell(19, 0);
313
509
 
314
510
  setTimeout(function () {