Skip to content

Commit

Permalink
Fixed problem with data population and wrote e2e tests #10456
Browse files Browse the repository at this point in the history
  • Loading branch information
wszymanski committed Jul 31, 2023
1 parent e8dd43f commit e552f5a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions handsontable/src/plugins/mergeCells/__tests__/mergeCells.spec.js
Expand Up @@ -1721,4 +1721,32 @@ describe('MergeCells', () => {
expect(coordsOnCellMouseDown).toEqual(jasmine.objectContaining({ row: 0, col: 0 }));
});
});

it('should set/unset "copyable" cell meta attribute after performing merge/unmerge', () => {
handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 10),
mergeCells: true
});

selectCell(2, 2, 4, 4);
keyDownUp(['control', 'm']);

getCell(2, 2);

expect(getCellMeta(2, 2).copyable).toBe(true);
expect(getCellMeta(2, 3).copyable).toBe(false);
expect(getCellMeta(2, 4).copyable).toBe(false);
expect(getCellMeta(3, 3).copyable).toBe(false);
expect(getCellMeta(3, 4).copyable).toBe(false);
expect(getCellMeta(4, 4).copyable).toBe(false);

keyDownUp(['control', 'm']);

expect(getCellMeta(2, 2).copyable).toBe(true);
expect(getCellMeta(2, 3).copyable).toBe(true);
expect(getCellMeta(2, 4).copyable).toBe(true);
expect(getCellMeta(3, 3).copyable).toBe(true);
expect(getCellMeta(3, 4).copyable).toBe(true);
expect(getCellMeta(4, 4).copyable).toBe(true);
});
});
1 change: 1 addition & 0 deletions handsontable/src/plugins/mergeCells/mergeCells.js
Expand Up @@ -495,6 +495,7 @@ export class MergeCells extends BasePlugin {
rangeEach(0, currentCollection.rowspan - 1, (i) => {
rangeEach(0, currentCollection.colspan - 1, (j) => {
this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'copyable');
});
});

Expand Down

0 comments on commit e552f5a

Please sign in to comment.