4f52d9f71fd847e17709be8ae23d077609548546d7ecc7ae89ee428dcb18d3dafb2df1e0cc6f03194b11e36e36f12c4c0510d0f39556918bd0ee29e58d09c3 920 B

12345678910111213141516171819202122232425262728293031323334
  1. describe('Core.getCopyableText', () => {
  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 string when `copyable` option is enabled', () => {
  13. handsontable({
  14. data: Handsontable.helper.createSpreadsheetData(5, 5),
  15. copyable: true
  16. });
  17. expect(getCopyableText(0, 0)).toBe('A1');
  18. expect(getCopyableText(0, 0, 1, 2)).toBe('A1\tB1\tC1\nA2\tB2\tC2');
  19. });
  20. it('should return empty string as copyable data when `copyable` option is disabled', () => {
  21. handsontable({
  22. data: Handsontable.helper.createSpreadsheetData(5, 5),
  23. copyable: false
  24. });
  25. expect(getCopyableText(0, 0)).toBe('');
  26. expect(getCopyableText(0, 0, 1, 2)).toBe('\t\t\n\t\t');
  27. });
  28. });