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();