6e3e6d9162138ecc90e56d9062e26bc4961fddcc3ef0ae37028f10af62f2e0c0e4aed8a390c7c42dfd04c19e7bcd556a797cf9f088ee24693a953c0343b160 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. describe('Core.getCopyableData', () => {
  2. var 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. it('should return copyable data when `copyable` option is enabled', () => {
  13. handsontable({
  14. data: Handsontable.helper.createSpreadsheetData(10, 10),
  15. copyable: true
  16. });
  17. expect(getCopyableData(0, 0)).toBe('A1');
  18. expect(getCopyableData(1, 1)).toBe('B2');
  19. expect(getCopyableData(5, 1)).toBe('B6');
  20. expect(getCopyableData(8, 9)).toBe('J9');
  21. });
  22. it('should return empty string as copyable data when `copyable` option is disabled', () => {
  23. handsontable({
  24. data: Handsontable.helper.createSpreadsheetData(10, 10),
  25. copyable: false
  26. });
  27. expect(getCopyableData(0, 0)).toBe('');
  28. expect(getCopyableData(1, 1)).toBe('');
  29. expect(getCopyableData(5, 1)).toBe('');
  30. expect(getCopyableData(8, 9)).toBe('');
  31. });
  32. });