Code coverage report for app/components/header/header.controller.js

Statements: 100% (37 / 37)      Branches: 100% (12 / 12)      Functions: 100% (8 / 8)      Lines: 100% (13 / 13)      Ignored: 2 statements, 4 branches     

All files » app/components/header/ » header.controller.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                                   
class HeaderController {
    constructor ($rootScope, Event) {
        Object.assign(this, {$rootScope, Event});
 
        // udpate header based on auth event
        this.$rootScope.$on(this.Event.AUTH_LOGIN, this.updateHeader.bind(this));
        this.$rootScope.$on(this.Event.AUTH_LOGOUT, this.updateHeader.bind(this));
        this.$rootScope.$on(this.Event.AUTH_SESSION_VALID, this.updateHeader.bind(this));
    }
 
    updateHeader (e, userInfo) {
        if (userInfo) {
            this.isLoggedIn = true;
            this.userInfo = userInfo;
        } else {
            this.isLoggedIn = false;
            this.userInfo = null;
        }
    }
 
    switchSidebar () {
        this.$rootScope.showSidebar = !this.$rootScope.showSidebar;
    }
}
 
HeaderController.$inject = ['$rootScope', 'Event'];
 
export default HeaderController;