e1019415bc776ec05e90ac6c44d90d4aae7755974420a8019abb5aba4ecb6939ff30989abd9db0c093167727e47f9c3658a08f2911fecc55ebbce5ce7ed4c0 2.3 KB

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