selectAll.spec.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. describe('Core.selectAll', () => {
  2. beforeEach(function() {
  3. this.$container = $('<div id="testContainer"></div>').appendTo('body');
  4. });
  5. afterEach(function() {
  6. if (this.$container) {
  7. destroy();
  8. this.$container.remove();
  9. }
  10. });
  11. it('should select all cells and clear previous selection', () => {
  12. const hot = handsontable({
  13. data: Handsontable.helper.createSpreadsheetObjectData(15, 20),
  14. width: 200,
  15. height: 100,
  16. selectionMode: 'multiple',
  17. colHeaders: true,
  18. rowHeaders: true,
  19. });
  20. selectCells([[1, 1, 2, 2], [2, 2, 4, 4]]);
  21. hot.view.wt.wtTable.holder.scrollTop = 100;
  22. hot.view.wt.wtTable.holder.scrollLeft = 100;
  23. selectAll();
  24. expect(`
  25. | ║ * : * : * : * : * : * |
  26. |===:===:===:===:===:===:===|
  27. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  28. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  29. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  30. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  31. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  32. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  33. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  34. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  35. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  36. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  37. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  38. | * ║ 0 : 0 : 0 : 0 : 0 : 0 |
  39. `).toBeMatchToSelectionPattern();
  40. // "Select all" shouldn't scroll te table.
  41. expect(hot.view.wt.wtTable.holder.scrollTop).toBe(100);
  42. expect(hot.view.wt.wtTable.holder.scrollLeft).toBe(100);
  43. });
  44. });