Sha256: 48cbf6e4fd5c9824a10cb2a656ac6386f48fc441c6f392f0922ba22fe332d9f0

Contents?: true

Size: 1.74 KB

Versions: 32

Compression:

Stored size: 1.74 KB

Contents

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

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

    beforeEach(inject(function(_$compile_, _$rootScope_) {
        compile = _$compile_;
        scope = _$rootScope_;
    }));

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

        compile(tableElement)(scope);
        scope.$digest();
        scope.$broadcast("$stateChangeSuccess", {}, {}, {}, {});
    });

    it("should create a new table element with just the thead", function() {
        var theads = tableElement.find('thead'),
            tbodys = tableElement.find('tbody');

        expect(theads.length).toEqual(2);
        expect(tbodys.length).toEqual(1);
    });

    it("should hide the original table's thead", function() {
        var originalTableHead = angular.element(tableElement.find('thead')[1]);

        expect(originalTableHead.css('display')).toBe('none');
    });

    it("should remove the duplicate row select from the cloned table if present", function() {
        var rowSelectTable = tableElement.clone();
        rowSelectTable.find('thead').prepend("<tr><th class='row-select'></th></tr>");
        compile(rowSelectTable)(scope);
        scope.$digest();
        scope.$broadcast("$stateChangeSuccess", {}, {}, {}, {});
        expect(rowSelectTable.find('.row-select').length).toBe(1);
    });
});

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
bastion-3.2.1 test/components/bst-nutupane-table.directive.test.js
bastion-3.2.0 test/components/bst-nutupane-table.directive.test.js
bastion-3.1.0 test/components/bst-nutupane-table.directive.test.js
bastion-3.0.1 test/components/bst-nutupane-table.directive.test.js
bastion-3.0.0 test/components/bst-nutupane-table.directive.test.js
bastion-2.1.0 test/components/bst-nutupane-table.directive.test.js
bastion-2.0.4 test/components/bst-nutupane-table.directive.test.js
bastion-2.0.3 test/components/bst-nutupane-table.directive.test.js
bastion-2.0.2 test/components/bst-nutupane-table.directive.test.js
bastion-2.0.1 test/components/bst-nutupane-table.directive.test.js
bastion-2.0.0 test/components/bst-nutupane-table.directive.test.js
bastion-1.0.2 test/components/bst-nutupane-table.directive.test.js