Sha256: 4ae7366807b63c5c85bd89b0da6c272bed6e56e7595d5cc0df5a8e6bf40d02f1

Contents?: true

Size: 1.96 KB

Versions: 21

Compression:

Stored size: 1.96 KB

Contents

/**
 * Copyright 2014 Red Hat, Inc.
 *
 * This software is licensed to you under the GNU General Public
 * License as published by the Free Software Foundation; either version
 * 2 of the License (GPLv2) or (at your option) any later version.
 * There is NO WARRANTY for this software, express or implied,
 * including the implied warranties of MERCHANTABILITY,
 * NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
 * have received a copy of GPLv2 along with this software; if not, see
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
 */


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

21 entries across 21 versions & 1 rubygems

Version Path
bastion-0.3.3 test/components/bst-form-buttons.directive.test.js
bastion-1.0.1 test/components/bst-form-buttons.directive.test.js
bastion-0.3.2 test/components/bst-form-buttons.directive.test.js
bastion-1.0.0 test/components/bst-form-buttons.directive.test.js
bastion-0.3.1 test/components/bst-form-buttons.directive.test.js
bastion-0.3.0 test/components/bst-form-buttons.directive.test.js
bastion-0.2.9 test/components/bst-form-buttons.directive.test.js
bastion-0.2.8 test/components/bst-form-buttons.directive.test.js
bastion-0.2.7 test/components/bst-form-buttons.directive.test.js
bastion-0.2.6 test/components/bst-form-buttons.directive.test.js
bastion-0.1.14 test/components/bst-form-buttons.directive.test.js
bastion-0.2.5 test/components/bst-form-buttons.directive.test.js
bastion-0.2.3 test/components/bst-form-buttons.directive.test.js
bastion-0.2.2 test/components/bst-form-buttons.directive.test.js
bastion-0.2.1 test/components/bst-form-buttons.directive.test.js
bastion-0.2.0 test/components/bst-form-buttons.directive.test.js
bastion-0.1.13 test/components/bst-form-buttons.directive.test.js
bastion-0.1.12 test/components/bst-form-buttons.directive.test.js
bastion-0.1.11 test/components/bst-form-buttons.directive.test.js
bastion-0.1.10 test/components/bst-form-buttons.directive.test.js