Sha256: e36bff84b7470b4b760c31847b9abd26b0a8d45cad670a37c27ede922d6cfa9e

Contents?: true

Size: 1.82 KB

Versions: 20

Compression:

Stored size: 1.82 KB

Contents

describe('Directive: bstContainerScroll', function() {
    var scope,
        compile,
        windowElement,
        tableElement;

    beforeEach(module('Bastion.components'));

    beforeEach(inject(function(_$compile_, _$rootScope_, $window) {
        compile = _$compile_;
        scope = _$rootScope_;
        windowElement = angular.element($window)
    }));

    beforeEach(function() {
        tableElement = angular.element(
            '<div bst-container-scroll>' +
              '<table>' +
                '<thead>' +
                  '<tr><th>Column 1</th></tr>' +
                '</thead>' +
                '<tbody>' +
                  '<tr>' +
                    '<td>Row 1</td>' +
                 '</tr>' +
                '</tbody>' +
              '</table>' +
            '</div>');

        compile(tableElement)(scope);
        scope.$digest();
    });

    it("should adjust the table height on window resize", function() {
        windowElement.height('100px');
        windowElement.trigger('resize');

        expect(tableElement.height()).toEqual(windowElement.height() - tableElement.offset().top);
    });

    it("should ensure that the element is at least 200px", function () {
        windowElement.height('200px');
        tableElement.css('padding-bottom', '200px');

        compile(tableElement)(scope);
        scope.$digest();

        windowElement.trigger('resize');
        expect(tableElement.height()).toEqual(300);
    });

    it("should add the nutupane details padding if it exists", function () {
        tableElement.css('padding-bottom', '10px');

        compile(tableElement)(scope);
        scope.$digest();

        windowElement.height('100px');
        windowElement.trigger('resize');

        expect(tableElement.height()).toEqual(windowElement.height() - (tableElement.offset().top + 10));
    });
});

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
bastion-4.3.1 test/components/bst-container-scroll.directive.test.js
bastion-4.3.0 test/components/bst-container-scroll.directive.test.js
bastion-4.2.2 test/components/bst-container-scroll.directive.test.js
bastion-4.2.1 test/components/bst-container-scroll.directive.test.js
bastion-4.2.0 test/components/bst-container-scroll.directive.test.js
bastion-4.1.0 test/components/bst-container-scroll.directive.test.js
bastion-4.0.0 test/components/bst-container-scroll.directive.test.js
bastion-3.4.4 test/components/bst-container-scroll.directive.test.js
bastion-3.4.3 test/components/bst-container-scroll.directive.test.js
bastion-3.4.2 test/components/bst-container-scroll.directive.test.js
bastion-3.4.1 test/components/bst-container-scroll.directive.test.js
bastion-3.4.0 test/components/bst-container-scroll.directive.test.js
bastion-3.3.6 test/components/bst-container-scroll.directive.test.js
bastion-3.3.5 test/components/bst-container-scroll.directive.test.js
bastion-3.3.4 test/components/bst-container-scroll.directive.test.js
bastion-3.3.3 test/components/bst-container-scroll.directive.test.js
bastion-3.3.2 test/components/bst-container-scroll.directive.test.js
bastion-3.3.1 test/components/bst-container-scroll.directive.test.js
bastion-3.3.0 test/components/bst-container-scroll.directive.test.js
bastion-3.2.2 test/components/bst-container-scroll.directive.test.js