Code coverage report for src\components\table\table.js

# all files / src/components/table/ table.js

28.57% Statements 6/21
100% Branches 0/0
20% Functions 1/5
28.57% Lines 6/21

    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
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    511×

    1×

    1×

    1×

    1×

    1×

     (function component(ng) {

      tableCtrl.$inject = ['voyage', 'dateFactory', 'checkedButton', 'voyagerListFactory'];

      ng.module('components')
        .component('table2', {
          templateUrl: './components/table/table.html',
          controller: tableCtrl,
          controllerAs: 'vm',
          bindings: {
            testData: '@'
          }
        });

      function tableCtrl(voyage, dateFactory, checkedButton, voyagerListFactory) {
        var vm = this;

        vm.getDate = dateFactory.getDate;

        checkedButton.selectedVoyages = [];

        vm.selectVoyager = voyagerListFactory.selectVoyager;

        vm.selectAllVoyager = voyagerListFactory.selectAllVoyager;

        vm.viewVoyage = voyagerListFactory.view;

        init();

        function init() {
          voyage.getList().then(function onSuccess(resolve) {
            vm.testData = ng.copy(resolve.data);

            fillSpaceRow();
          });
        }

        function fillSpaceRow() {
          var s = ' ';
          var length = Object.keys(vm.testData.data).length;

          for (var i = 0; i < 15 - length; i++){
            vm.testData.data.push(s);
            s += ' ';
          }
        }

      }

    })(angular);