Code coverage report for src/form/form-buttons/form-buttons.component.js

Statements: 100% (12 / 12)      Branches: 77.78% (7 / 9)      Functions: 100% (3 / 3)      Lines: 100% (12 / 12)      Ignored: none     

All files » src/form/form-buttons/ » form-buttons.component.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411                             2   2 2 2     2         1 6   6 6 2       6        
angular.module('patternfly.form').component('pfFormButtons', {
 
  bindings: {
    pfHandleCancel: '&pfOnCancel',
    pfHandleSave: '&pfOnSave',
    pfWorking: '=',
    pfButtonContainerClass: '@'
  },
  require: {
    form: '^form'
  },
  templateUrl: 'form/form-buttons/form-buttons.html',
  controller: function () {
    'use strict';
 
    var ctrl = this;
 
    ctrl.$onInit = function () {
      Eif (ctrl.pfWorking === undefined) {
        ctrl.pfWorking = false;
      }
 
      angular.extend(ctrl, {
        isInvalid: isInvalid
      });
    };
 
    function isInvalid () {
      var invalid = ctrl.form.$invalid;
 
      Eif (ctrl.form && ctrl.form.name && ctrl.form.name.$error) {
        if (ctrl.form.name.$error.server) {
          invalid = false;
        }
      }
 
      return invalid;
    }
  }
});