Code coverage report for src/canvas-view/canvas/node-toolbar.component.js

Statements: 14.29% (2 / 14)      Branches: 0% (0 / 4)      Functions: 25% (1 / 4)      Lines: 14.29% (2 / 14)      Ignored: none     

All files » src/canvas-view/canvas/ » node-toolbar.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 351     1                                                              
(function () {
  'use strict';
 
  angular.module('patternfly.canvas')
    .component('nodeToolbar', {
      templateUrl: 'canvas-view/canvas/node-toolbar.html',
      bindings: {
        node: '=',
        nodeActions: '=',
        nodeClickHandler: '<',
        nodeCloseHandler: '<'
      },
      controller: function NodeToolbarController ($scope) {
        var ctrl = this;
        ctrl.selectedAction = 'none';
 
        ctrl.actionIconClicked = function (action) {
          ctrl.selectedAction = action;
          $scope.$emit('nodeActionClicked', {'action': action, 'node': ctrl.node});
          if (angular.isFunction(ctrl.nodeClickHandler)) {
            ctrl.nodeClickHandler(action, ctrl.node);
          }
        };
 
        ctrl.close = function () {
          ctrl.selectedAction = 'none';
          $scope.$emit('nodeActionClosed');
          if (angular.isFunction(ctrl.nodeCloseHandler)) {
            ctrl.nodeCloseHandler();
          }
        };
      }
    });
})();