Sha256: 89772e49e48d82c038427637fa7667366c21d3899e10696d9a7560d1de92c3fb

Contents?: true

Size: 1.41 KB

Versions: 70

Compression:

Stored size: 1.41 KB

Contents

describe('Directive: bstFormButtons', function() {
    var $scope, $compile, element;

    beforeEach(module(
        'Bastion.components',
        'components/views/bst-save-control.html',
        'components/views/bst-form-buttons.html'
    ));

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

    beforeEach(function() {
        element = '<form name="testForm">' +
                    '<input name="name" ng-model="fake.name" required>' +
                    '<div bst-form-buttons ' +
                        'on-cancel="transitionTo(\'product.index\')" ' +
                        'on-save="save(product)" ' +
                        'working="working"> ' +
                   '</div>' +
                 '</form>';

        element = $compile(element)($scope);
        $scope.$digest();
    });

    it("should set create button to disabled if no server validator is set but the form is invalid", function() {
        var disabled = angular.element(element).find('.btn-primary').attr('disabled');
        expect(disabled).toBe('disabled');
    });

    it("should set create button to enabled if a server validator is set", function() {
        $scope.testForm.name.$error.server = true;
        $scope.$digest();
        var disabled = angular.element(element).find('.btn-primary').attr('disabled');
        expect(disabled).toBe(undefined);
    });

});

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bastion-6.1.23 test/components/bst-form-buttons.directive.test.js
bastion-6.1.22 test/components/bst-form-buttons.directive.test.js
bastion-6.1.21 test/components/bst-form-buttons.directive.test.js
bastion-6.1.20 test/components/bst-form-buttons.directive.test.js
bastion-6.1.19 test/components/bst-form-buttons.directive.test.js
bastion-6.1.18 test/components/bst-form-buttons.directive.test.js
bastion-6.1.17 test/components/bst-form-buttons.directive.test.js
bastion-6.1.16 test/components/bst-form-buttons.directive.test.js
bastion-6.1.15 test/components/bst-form-buttons.directive.test.js
bastion-6.1.14 test/components/bst-form-buttons.directive.test.js
bastion-6.1.13 test/components/bst-form-buttons.directive.test.js
bastion-6.1.12 test/components/bst-form-buttons.directive.test.js
bastion-6.1.11 test/components/bst-form-buttons.directive.test.js
bastion-6.1.10 test/components/bst-form-buttons.directive.test.js
bastion-6.1.9 test/components/bst-form-buttons.directive.test.js
bastion-6.1.8 test/components/bst-form-buttons.directive.test.js
bastion-6.1.7 test/components/bst-form-buttons.directive.test.js
bastion-6.1.6 test/components/bst-form-buttons.directive.test.js
bastion-6.1.5 test/components/bst-form-buttons.directive.test.js
bastion-6.1.4 test/components/bst-form-buttons.directive.test.js