Code coverage report for src\components\content-user\content-user.js

# all files / src/components/content-user/ content-user.js

61.29% Statements 19/31
42.86% Branches 6/14
66.67% Functions 4/6
61.29% Lines 19/31

    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
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    1011×
    1×

    1×

    1×
    3×

    3×

    3×

    3×

    3×
    2×
    1×

    1×

    3×
    5083×
    5082×

    5082×

    3×

    3×

    3×

     (function component(ng) {
      ng.module('components')
        .component('exContentUser', {
          templateUrl: './components/content-user/content-user.html',
          controller: contentUserCtrl,
          controllerAs: 'vm',
          bindings: {
          }
        });

      contentUserCtrl.$inject = ['userFilter', '$scope'];

      function contentUserCtrl(userFilter, $scope) {
        var vm = this;

        vm.currentUser = {
            firstName: 'Portal',
            lastName: 'administrator',
            login: 'hulio',
            email: 'no-reply@sportmaster.ru',
            organization: 'Кюне+Нагель',
            password: '123321'
        };

        vm.pass = {};

        vm.style = {
            success: {
                'border-color': '#5cb85c',
                'box-shadow': '0 0 8px #5cb85c'
            },
            danger: {
                'border-color': '#d9534f',
                'box-shadow': '0 0 8px #d9534f'
            },
            warning: {
                'border-color': '#f0ad4e',
                'box-shadow': '0 0 8px #f0ad4e'
            },
            none: {
                'border-color': '',
                'box-shadow': ''
            },

            lable: {
                visible: {'display': 'block'},
                unvisible: {'display': 'none'}
            }
        }

        $scope.$watch('vm.pass.newPassword', function(newValue) {
            if (newValue != undefined) {
                Iif (newValue.length > 0) {
                    vm.verifyNew = vm.style.warning;
                    //vm.newLable = style.lable.visible;

                    if (newValue.length >= 6) {
                        vm.verifyNew = vm.style.success;
                    // vm.newLable = style.lable.unvisible;
                    }
                } else {
                    vm.verifyNew = vm.style.none;
                // vm.newLable = style.lable.unvisible;
                }
            }
        });

        $scope.$watch('vm.pass.newPasswordVerify', function(newValue) {
            if (newValue != undefined) {
                Iif (newValue.length > 0) {
                    vm.verifyPass = vm.style.warning;

                    if (newValue.length >= 6) {
                        vm.verifyPass = vm.style.success;

                        if (newValue != vm.pass.newPassword) {
                            vm.verifyPass = vm.style.danger;
                        }
                    }
                } else {
                    vm.verifyPass = vm.style.none;
                }
            }
        });

        vm.clear = function() {
            vm.pass = {};

            vm.verifyPass = vm.style.none;
            vm.verifyNew = vm.style.none;
        };

        vm.save = function() {
            console.log('save()');
        }

        userFilter.registr(vm.clear, vm.save);

      }
    })(angular);