currentRowClassName.spec.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. describe('settings', () => {
  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. describe('currentRowClassName', () => {
  13. it('should apply currentRowClassName to cells in row where there is a selection', function() {
  14. handsontable({
  15. data: Handsontable.helper.createSpreadsheetData(5, 7),
  16. currentRowClassName: 'currentRowClassName'
  17. });
  18. selectCell(2, 2);
  19. expect(this.$container.find('td.currentRowClassName').length).toEqual(6);
  20. });
  21. it('should apply currentRowClassName from cells after deselection', function() {
  22. handsontable({
  23. data: Handsontable.helper.createSpreadsheetData(5, 7),
  24. currentRowClassName: 'currentRowClassName'
  25. });
  26. selectCell(2, 2);
  27. deselectCell();
  28. expect(this.$container.find('td.currentRowClassName').length).toEqual(0);
  29. });
  30. });
  31. describe('currentColClassName', () => {
  32. it('should apply currentColClassName to cells in row where there is a selection', function() {
  33. handsontable({
  34. data: Handsontable.helper.createSpreadsheetData(5, 7),
  35. currentColClassName: 'currentColClassName'
  36. });
  37. selectCell(2, 2);
  38. expect(this.$container.find('td.currentColClassName').length).toEqual(4);
  39. });
  40. it('should remove currentColClassName from cells after deselection', function() {
  41. handsontable({
  42. data: Handsontable.helper.createSpreadsheetData(5, 7),
  43. currentColClassName: 'currentColClassName'
  44. });
  45. selectCell(2, 2);
  46. deselectCell();
  47. expect(this.$container.find('td.currentColClassName').length).toEqual(0);
  48. });
  49. });
  50. });