jHueTableScrollerSpec.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. describe("jHueTableScroller plugin", function () {
  2. var defaultTableOriginalHeight = 0;
  3. var minHeightTableOriginalHeight = 0;
  4. beforeEach(function () {
  5. jasmine.getFixtures().fixturesPath = 'static/jasmine/';
  6. loadFixtures('jHueTableScrollerFixture.html');
  7. defaultTableOriginalHeight = $("#defaultTable").height();
  8. minHeightTableOriginalHeight = $("#minHeightTable").height();
  9. $(".table").dataTable({
  10. "bPaginate":false,
  11. "bLengthChange":false,
  12. "bInfo":false
  13. });
  14. $(".dataTables_wrapper").jHueTableScroller();
  15. });
  16. it("should make the default table scroll with min height enabled", function () {
  17. expect($("#defaultTable").parent(".dataTables_wrapper").height()).toBeLessThan(defaultTableOriginalHeight);
  18. expect($("#defaultTable").parent(".dataTables_wrapper").height()).toBe(400);
  19. });
  20. it("should set a specific minimum height when data-tablescroller-min-height is specified", function () {
  21. expect($("#minHeightTable").parent(".dataTables_wrapper").height()).toBeLessThan(minHeightTableOriginalHeight);
  22. expect($("#minHeightTable").parent(".dataTables_wrapper").height()).toBeGreaterThan($("#defaultTable").parent(".dataTables_wrapper").height());
  23. });
  24. it("should disable a minimum height when data-tablescroller-disable-min-height is specified", function () {
  25. expect($("#disableMinHeightTable").parent(".dataTables_wrapper").height()).not.toEqual(400)
  26. });
  27. it("should ignore the minimum height when the table is smaller than 400", function () {
  28. expect($("#shortMinHeightTable").parent(".dataTables_wrapper").height()).toBeLessThan(400)
  29. });
  30. it("should disable the plugin when data-tablescroller-disable is specified", function () {
  31. expect($("#disableTable").parent(".dataTables_wrapper").css("overflow-y")).toBe("visible");
  32. });
  33. });