copyable.spec.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. describe('settings', () => {
  2. describe('copyable', () => {
  3. var id = 'testContainer';
  4. beforeEach(function() {
  5. this.$container = $(`<div id="${id}"></div>`).appendTo('body');
  6. });
  7. afterEach(function() {
  8. if (this.$container) {
  9. destroy();
  10. this.$container.remove();
  11. }
  12. });
  13. it('by default, CTRL+C should NOT copy the password value', () => {
  14. handsontable({
  15. data: [
  16. ['Joe', 'Secret', 'Jack']
  17. ],
  18. columns: [
  19. {},
  20. {
  21. type: 'password'
  22. },
  23. {}
  24. ]
  25. });
  26. expect(getCopyableText(0, 0, 0, 2)).toMatch('Joe\t\tJack');
  27. });
  28. it('with copyable=true, CTRL+C should copy the password value', () => {
  29. handsontable({
  30. data: [
  31. ['Joe', 'Secret', 'Jack']
  32. ],
  33. columns: [
  34. {},
  35. {
  36. type: 'password',
  37. copyable: true
  38. },
  39. {}
  40. ]
  41. });
  42. expect(getCopyableText(0, 0, 0, 2)).toMatch('Joe\tSecret\tJack');
  43. });
  44. it('with copyable=false, CTRL+C should NOT copy the password value', () => {
  45. handsontable({
  46. data: [
  47. ['Joe', 'Secret', 'Jack']
  48. ],
  49. columns: [
  50. {},
  51. {
  52. type: 'password',
  53. copyable: false
  54. },
  55. {}
  56. ]
  57. });
  58. expect(getCopyableText(0, 0, 0, 2)).toMatch('Joe\t\tJack');
  59. });
  60. });
  61. });