currentHeaderClassName.spec.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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('currentHeaderClassName', () => {
  13. it('should apply default currentHeaderClassName to cells in row where there is a selection', function() {
  14. handsontable({
  15. rowHeaders: true,
  16. colHeaders: true,
  17. data: Handsontable.helper.createSpreadsheetData(5, 7),
  18. });
  19. selectCell(2, 2);
  20. expect(this.$container.find('.ht_master th.ht__highlight').length).toEqual(2);
  21. });
  22. it('should apply default currentHeaderClassName from cells after deselection', function() {
  23. handsontable({
  24. rowHeaders: true,
  25. colHeaders: true,
  26. data: Handsontable.helper.createSpreadsheetData(5, 7),
  27. });
  28. selectCell(2, 2);
  29. deselectCell();
  30. expect(this.$container.find('.ht_master th.ht__highlight').length).toEqual(0);
  31. });
  32. it('should apply custom currentHeaderClassName to cells in row where there is a selection', function() {
  33. handsontable({
  34. rowHeaders: true,
  35. colHeaders: true,
  36. data: Handsontable.helper.createSpreadsheetData(5, 7),
  37. currentHeaderClassName: 'currentHeaderClassName'
  38. });
  39. selectCell(2, 2);
  40. expect(this.$container.find('.ht_master th.currentHeaderClassName').length).toEqual(2);
  41. });
  42. });
  43. });