8e0328d0b5327387f545d0e2128bfd7da01f613501e83a6b11c0b3e4e24828a5a63f5fced2a36d0405e9efc0ed0318a46cbee0f9d09fe88d7281688fb1ffbb 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. describe('Core_init', () => {
  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. it('should respect startRows and startCols when no data is provided', function() {
  13. this.$container.remove();
  14. this.$container = $(`<div id="${id}"></div>`).appendTo('body');
  15. handsontable();
  16. expect(countRows()).toEqual(5); // as given in README.md
  17. expect(countCols()).toEqual(5); // as given in README.md
  18. });
  19. it('should respect width provided in inline style', function() {
  20. this.$container.css({
  21. overflow: 'auto',
  22. width: '200px'
  23. });
  24. handsontable({
  25. data: [
  26. ['ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC']
  27. ]
  28. });
  29. expect(this.$container.width()).toEqual(200);
  30. });
  31. it('should respect width provided in CSS class', function() {
  32. $('<style>.myTable {overflow: auto; width: 200px}</style>').appendTo('head');
  33. this.$container.addClass('myTable');
  34. handsontable({
  35. data: [
  36. ['ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC']
  37. ]
  38. });
  39. expect(this.$container.width()).toEqual(200);
  40. });
  41. it('should construct when container is not appended to document', function() {
  42. this.$container.remove();
  43. handsontable();
  44. expect(getData()).toBeTruthy();
  45. });
  46. it('Handsontable.Dom should be available as a helper to the plugins', () => {
  47. // all public methods of Handsontable.Dom should be exposed here
  48. expect(Handsontable.dom.closest).toBeDefined();
  49. expect(Handsontable.dom.isChildOf).toBeDefined();
  50. expect(Handsontable.dom.index).toBeDefined();
  51. expect(Handsontable.dom.hasClass).toBeDefined();
  52. expect(Handsontable.dom.addClass).toBeDefined();
  53. expect(Handsontable.dom.removeClass).toBeDefined();
  54. expect(Handsontable.dom.removeTextNodes).toBeDefined();
  55. expect(Handsontable.dom.empty).toBeDefined();
  56. expect(Handsontable.dom.fastInnerHTML).toBeDefined();
  57. expect(Handsontable.dom.fastInnerText).toBeDefined();
  58. expect(Handsontable.dom.isVisible).toBeDefined();
  59. expect(Handsontable.dom.offset).toBeDefined();
  60. expect(Handsontable.dom.getComputedStyle).toBeDefined();
  61. expect(Handsontable.dom.outerWidth).toBeDefined();
  62. expect(Handsontable.dom.outerHeight).toBeDefined();
  63. expect(Handsontable.dom.getCaretPosition).toBeDefined();
  64. expect(Handsontable.dom.setCaretPosition).toBeDefined();
  65. });
  66. });