Skip to content

Commit

Permalink
Fix & test #5434
Browse files Browse the repository at this point in the history
  • Loading branch information
wszymanski committed Oct 1, 2018
1 parent 692c11d commit dde068f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/columnSorting/columnSorting.js
Expand Up @@ -791,7 +791,7 @@ class ColumnSorting extends BasePlugin {
*/
onBeforeOnCellMouseDown(event, coords, TD, blockCalculations) {
// Click below the level of column headers
if (coords.row >= 0) {
if (coords.row >= 0 || coords.col < 0) {
return;
}

Expand All @@ -809,7 +809,7 @@ class ColumnSorting extends BasePlugin {
*/
onAfterOnCellMouseDown(event, coords) {
// Click below the level of column headers
if (coords.row >= 0) {
if (coords.row >= 0 || coords.col < 0) {
return;
}

Expand Down
17 changes: 17 additions & 0 deletions src/plugins/columnSorting/test/columnSorting.e2e.js
Expand Up @@ -332,6 +332,23 @@ describe('ColumnSorting', () => {
]);
});

it('should not throw an exception when clicked on the top-left corner', async() => {
const onErrorSpy = spyOn(window, 'onerror');

handsontable({
colHeaders: true,
rowHeaders: true,
data: arrayOfObjects(),
columnSorting: true
});

$('.ht_clone_top_left_corner .htCore span').simulate('mousedown');
$('.ht_clone_top_left_corner .htCore span').simulate('click');
$('.ht_clone_top_left_corner .htCore span').simulate('mouseup');

expect(onErrorSpy).not.toHaveBeenCalled();
});

it('should not throw error when trying run handsontable with columnSorting and autoRowSize in the same time.', () => {
let errors = 0;

Expand Down

0 comments on commit dde068f

Please sign in to comment.