autoWrapCol.spec.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. describe('settings', () => {
  2. const id = 'testContainer';
  3. beforeEach(function() {
  4. this.$container = $(`<div id="${id}"></div>`).appendTo('body');
  5. });
  6. afterEach(function() {
  7. if (this.$container) {
  8. destroy();
  9. this.$container.remove();
  10. }
  11. });
  12. describe('autoWrapCol', () => {
  13. it('should be defaults true', () => {
  14. const hot = handsontable({
  15. data: Handsontable.helper.createSpreadsheetData(5, 5)
  16. });
  17. expect(hot.getSettings().autoWrapCol).toBe(true);
  18. });
  19. it('should move to the neighboring column when it reaches the end of the current', () => {
  20. handsontable({
  21. data: Handsontable.helper.createSpreadsheetData(5, 5),
  22. autoWrapCol: true
  23. });
  24. selectCell(4, 0);
  25. expect(getSelected()).toEqual([[4, 0, 4, 0]]);
  26. keyDownUp('arrow_down');
  27. expect(getSelected()).toEqual([[0, 1, 0, 1]]);
  28. keyDownUp('arrow_up');
  29. expect(getSelected()).toEqual([[4, 0, 4, 0]]);
  30. });
  31. it('should move to the start of the table when it reaches the end of the table', () => {
  32. handsontable({
  33. data: Handsontable.helper.createSpreadsheetData(5, 5),
  34. autoWrapCol: true
  35. });
  36. selectCell(4, 4);
  37. expect(getSelected()).toEqual([[4, 4, 4, 4]]);
  38. keyDownUp('arrow_down');
  39. expect(getSelected()).toEqual([[0, 0, 0, 0]]);
  40. keyDownUp('arrow_up');
  41. expect(getSelected()).toEqual([[4, 4, 4, 4]]);
  42. });
  43. });
  44. });