Adding keyboard shortcut to toggle notifications [S]

Change-Id: I5d69cb14141f4c484738920efee96f6c117527bc
(cherry picked from commit f37172583a9566708567e55a65f4426e7e5216d7)
diff --git a/src/app/core/header/header.spec.ts b/src/app/core/header/header.spec.ts
index eb236b1..a4a7d90 100644
--- a/src/app/core/header/header.spec.ts
+++ b/src/app/core/header/header.spec.ts
@@ -24,6 +24,7 @@
 import 'angular-mocks';
 import {xosHeader, INotification} from './header';
 import {Subject} from 'rxjs';
+import {IXosDebugService} from '../debug/debug.service';
 
 let element, scope: angular.IRootScopeService, compile: ng.ICompileService, isolatedScope;
 const events = new Subject();
@@ -79,6 +80,17 @@
   registerKeyBinding: jasmine.createSpy('registerKeyBinding')
 };
 
+const MockXosDebug: IXosDebugService = {
+  status: {
+    global: false,
+    events: false,
+    modelsTab: false,
+    notifications: true
+  },
+  setupShortcuts: jasmine.createSpy('debug.createShortcuts'),
+  toggleDebug: jasmine.createSpy('debug.toggleDebug')
+};
+
 describe('header component', () => {
   beforeEach(() => {
     angular
@@ -96,7 +108,8 @@
       .value('StyleConfig', {
         logo: 'cord-logo.png',
       })
-      .value('SearchService', {});
+      .value('SearchService', {})
+      .value('XosDebug', MockXosDebug);
 
     angular.mock.module('xosHeader');
   });
@@ -146,7 +159,16 @@
     });
   });
 
-  it('should display a toastr for a new notification', () => {
+  it('should not display a toastr for a new notification (if notifications are disabled)', () => {
+      MockXosDebug.status.notifications = false;
+      sendEvent(infoNotification);
+      scope.$digest();
+
+      expect(MockToastr.info).not.toHaveBeenCalled();
+  });
+
+  it('should display a toastr for a new notification (if notifications are enabled)', () => {
+    MockXosDebug.status.notifications = true;
     sendEvent(infoNotification);
     scope.$digest();
 
diff --git a/src/app/core/header/header.ts b/src/app/core/header/header.ts
index a465f8f..26f6fd0 100644
--- a/src/app/core/header/header.ts
+++ b/src/app/core/header/header.ts
@@ -28,6 +28,7 @@
 import {IXosKeyboardShortcutService} from '../services/keyboard-shortcut';
 import {Subscription} from 'rxjs';
 import {IXosConfigHelpersService} from '../services/helpers/config.helpers';
+import {IXosDebugService} from '../debug/debug.service';
 
 export interface INotification extends IWSEvent {
   viewed?: boolean;
@@ -47,7 +48,8 @@
     'StyleConfig',
     'SearchService',
     'XosKeyboardShortcut',
-    'ConfigHelpers'
+    'ConfigHelpers',
+    'XosDebug'
   ];
   public notifications: INotification[] = [];
   public newNotifications: INotification[] = [];
@@ -73,7 +75,8 @@
     private StyleConfig: IXosStyleConfig,
     private SearchService: IXosSearchService,
     private XosKeyboardShortcut: IXosKeyboardShortcutService,
-    private ConfigHelpers: IXosConfigHelpersService
+    private ConfigHelpers: IXosConfigHelpersService,
+    private XosDebugService: IXosDebugService
   ) {
 
   }
@@ -123,6 +126,12 @@
         (event: IWSEvent) => {
           this.$scope.$evalAsync(() => {
 
+            if (!this.XosDebugService.status.notifications) {
+              // NOTE: notifications can be disabled
+              return;
+            }
+
+
             if (event.model === 'Diag') {
               // NOTE skip notifications for Diag model
               return;