98334ca09918d9b6108e9b392492bd1c1b58129b5cae3e0f06278135de69652d473a5b9b5d5f6fa47685697bf3efd3c62fffab72cb67363d452dfd78de0644 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. 'use strict';
  2. describe('manualRowMove', function () {
  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. describe('UI', function () {
  14. it('should append UI elements to wtHider after click on row header', function () {
  15. var hot = handsontable({
  16. data: Handsontable.helper.createSpreadsheetData(30, 30),
  17. rowHeaders: true,
  18. manualRowMove: true
  19. });
  20. var $headerTH = this.$container.find('tbody tr:eq(0) th:eq(0)');
  21. $headerTH.simulate('mousedown');
  22. $headerTH.simulate('mouseup');
  23. $headerTH.simulate('mousedown');
  24. expect(this.$container.find('.ht__manualRowMove--guideline').length).toBe(1);
  25. expect(this.$container.find('.ht__manualRowMove--backlight').length).toBe(1);
  26. });
  27. it('should part of UI elements be visible on dragging action', function () {
  28. var hot = handsontable({
  29. data: Handsontable.helper.createSpreadsheetData(30, 30),
  30. rowHeaders: true,
  31. manualRowMove: true
  32. });
  33. var $headerTH = this.$container.find('tbody tr:eq(0) th:eq(0)');
  34. $headerTH.simulate('mousedown');
  35. $headerTH.simulate('mouseup');
  36. $headerTH.simulate('mousedown');
  37. expect(this.$container.find('.ht__manualRowMove--guideline:visible').length).toBe(0);
  38. expect(this.$container.find('.ht__manualRowMove--backlight:visible').length).toBe(1);
  39. });
  40. it('should all of UI elements be visible on dragging action', function () {
  41. var hot = handsontable({
  42. data: Handsontable.helper.createSpreadsheetData(30, 30),
  43. rowHeaders: true,
  44. manualRowMove: true
  45. });
  46. var $headers = [this.$container.find('tbody tr:eq(0) th:eq(0)'), this.$container.find('tbody tr:eq(1) th:eq(0)'), this.$container.find('tbody tr:eq(2) th:eq(0)')];
  47. $headers[0].simulate('mousedown');
  48. $headers[0].simulate('mouseup');
  49. $headers[0].simulate('mousedown');
  50. $headers[1].simulate('mouseover');
  51. $headers[2].simulate('mouseover');
  52. expect(this.$container.find('.ht__manualRowMove--guideline:visible').length).toBe(1);
  53. expect(this.$container.find('.ht__manualRowMove--backlight:visible').length).toBe(1);
  54. });
  55. });
  56. });