jHueTableScrollerSpec.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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(500);
  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(500)
  26. });
  27. it("should disable the plugin when data-tablescroller-disable is specified", function () {
  28. expect($("#disableTable").parent(".dataTables_wrapper").css("overflow-y")).toBe("visible");
  29. });
  30. });