OK-513 Unit tests added
diff --git a/src/app/common/router.animations.ts b/src/app/common/router.animations.ts
index 8808d46..e3f3ca0 100644
--- a/src/app/common/router.animations.ts
+++ b/src/app/common/router.animations.ts
@@ -1,35 +1,5 @@
 import { trigger, state, animate, style, transition } from '@angular/animations';
 
-export function slideToRight() {
-    return trigger('slideToRight', [
-        state('void', style({ position: 'absolute', width: '100%' })),
-        state('*', style({ position: 'absolute', width: '100%' })),
-        transition(':enter', [
-            style({ transform: 'translateX(-100%)' }),
-            animate('0.5s ease-in-out', style({ transform: 'translateX(0%)' }))
-        ]),
-        transition(':leave', [
-            style({ transform: 'translateX(0%)' }),
-            animate('0.5s ease-in-out', style({ transform: 'translateX(100%)' }))
-        ])
-    ]);
-}
-
-export function slideToLeft() {
-    return trigger('slideToLeft', [
-        state('void', style({ position: 'absolute', width: '100%' })),
-        state('*', style({ position: 'absolute', width: '100%' })),
-        transition(':enter', [
-            style({ transform: 'translateX(100%)' }),
-            animate('0.5s ease-in-out', style({ transform: 'translateX(0%)' }))
-        ]),
-        transition(':leave', [
-            style({ transform: 'translateX(0%)' }),
-            animate('0.5s ease-in-out', style({ transform: 'translateX(-100%)' }))
-        ])
-    ]);
-}
-
 export  function  slideInOpacity() {
     return  trigger('slideInOpacity', [
         state('void',  style({  opacity:  0 })),
diff --git a/src/app/dialogs/logout/logout.component.spec.ts b/src/app/dialogs/logout/logout.component.spec.ts
index 2f49536..7043f47 100644
--- a/src/app/dialogs/logout/logout.component.spec.ts
+++ b/src/app/dialogs/logout/logout.component.spec.ts
@@ -2,20 +2,44 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { By } from '@angular/platform-browser';
 import { DebugElement } from '@angular/core';
+import { MdDialogRef } from '@angular/material';
 import { AbstractMockObservableService } from '../../common/abstract-mock-observable.service';
 import { LogoutComponent } from './logout.component';
+import { MessageService } from '../../services/message.service';
+import { Router } from '@angular/router';
+
+class FakeRouter {
+  navigate(commands: any[]) {
+    return commands[0];
+  }
+}
 
 describe('LogoutComponent', () => {
   let component: LogoutComponent;
   let fixture: ComponentFixture<LogoutComponent>;
+  let routerStub: FakeRouter;
+  let messageService;
+  let router: Router;
+  
+    routerStub = {
+      navigate: jasmine.createSpy('navigate').and.callThrough()
+    };
 
   class MockDialogRef extends AbstractMockObservableService {
     close() { }
   }
 
   beforeEach(async(() => {
+    messageService = new MessageService();
+    router = new FakeRouter() as any as Router;
+
     TestBed.configureTestingModule({
-      declarations: [ LogoutComponent ]
+      declarations: [ LogoutComponent ],
+      providers: [
+        { provide: MdDialogRef, useClass: MockDialogRef },
+        { provide: Router, useValue: routerStub },
+        { provide: MessageService, useValue: messageService }       
+      ]
     })
     .compileComponents();
   }));
@@ -26,9 +50,12 @@
     fixture.detectChanges();
   });
 
-/*
-  it('should create', () => {
-    expect(component).toBeTruthy();
+  /*
+  fit('should navigate to logout page on abmelden click', () => {
+    component.logout();
+    expect(routerStub.navigate).toHaveBeenCalledWith(['/logout']);
   });
   */
+
+
 });
diff --git a/src/app/dialogs/shift-change-protocol/shift-change-protocol.component.ts b/src/app/dialogs/shift-change-protocol/shift-change-protocol.component.ts
index 82ed5c3..8f75cca 100644
--- a/src/app/dialogs/shift-change-protocol/shift-change-protocol.component.ts
+++ b/src/app/dialogs/shift-change-protocol/shift-change-protocol.component.ts
@@ -29,23 +29,4 @@
     this.dialogRef.close();
     this.messageService.deactivateMessage();
   }
-
-  print() {
-    let printContents, popupWin;
-    printContents = document.getElementById('print-section').innerHTML;
-    popupWin = window.open('', '_blank');
-    popupWin.document.open();
-    popupWin.document.write(`
-      <html>
-        <head>
-          <h2>
-            Schicht übergeben
-          </h2>
-          <link rel="stylesheet" type="text/css" href="print.css">
-        </head>
-        <body onload="window.print();window.close()">${printContents}</body>
-      </html>`
-    );
-    popupWin.document.close();
-  }
 }
diff --git a/src/app/lists/historical-shift-changes/historical-shift-changes.component.spec.ts b/src/app/lists/historical-shift-changes/historical-shift-changes.component.spec.ts
index 0c5c5fd..fd6689d 100644
--- a/src/app/lists/historical-shift-changes/historical-shift-changes.component.spec.ts
+++ b/src/app/lists/historical-shift-changes/historical-shift-changes.component.spec.ts
@@ -12,6 +12,8 @@
 import { By } from '@angular/platform-browser';
 import { click } from '../../testing/index';
 import { SessionContext } from '../../common/session-context';
+import { Globals } from '../../common/globals';
+import { DateRange } from '../../model/date-range';
 
 describe('HistoricalShiftChangesComponent', () => {
   let component: HistoricalShiftChangesComponent;
@@ -19,6 +21,15 @@
   let mockRespService: MockResponsibilityService;
   let router: Router;
 
+  class MockEvent {
+    picker: Picker = new Picker();
+  }
+
+  class Picker {
+    startDate: string;
+    endDate: string;
+  }
+
   class FakeRouter {
     navigate(commands: any[]) {
       return commands[0];
@@ -34,8 +45,10 @@
     };
   }
 
+  let sessionContext: SessionContext;
 
   beforeEach(async(() => {
+    sessionContext = new SessionContext();
     mockRespService = new MockResponsibilityService();
     router = new FakeRouter() as any as Router;
     TestBed.configureTestingModule({
@@ -102,5 +115,38 @@
       click(des[2]);      
     });          
   }));
+
+  it('should store the picked date range in sessioncontext', async(() => {
+    const mockEvent: MockEvent = new MockEvent();
+    mockEvent.picker.startDate = '2017-09-03T22:00:00.000Z';
+    mockEvent.picker.endDate = '2017-09-06T22:00:00.000Z';
+    component.storeDateRange(mockEvent);
+    fixture.detectChanges();
+
+    fixture.whenStable().then(() => { // wait for async getResponsibilities      
+      const dateRange: DateRange = sessionContext.getDateRange(Globals.DATE_RANGE_PAST);
+      expect(dateRange.dateFrom).toEqual(mockEvent.picker.startDate);
+      expect(dateRange.dateTo).toEqual(mockEvent.picker.endDate);
+    });
+  }));
+
+  it('should get the stored date range from sessioncontext', async(() => {
+    spyOn(component, 'setDefaultDateRange').and.callThrough();
+    const mockEvent: MockEvent = new MockEvent();    
+    mockEvent.picker.startDate = '2017-09-03T22:00:00.000Z';
+    mockEvent.picker.endDate = '2017-09-06T22:00:00.000Z';
+
+    const startDate = new Date(mockEvent.picker.startDate);
+    const endDate = new Date(mockEvent.picker.endDate);
+
+    component.storeDateRange(mockEvent);
+    fixture.detectChanges();    
+
+    fixture.whenStable().then(() => { // wait for async getResponsibilities            
+      expect(component.setDefaultDateRange).toHaveBeenCalled();
+      expect(component.startDate).toEqual(startDate);
+      expect(component.endDate).toEqual(endDate);
+    });
+  }));
   
 });
diff --git a/src/app/lists/open-notifications/open-notifications.component.spec.ts b/src/app/lists/open-notifications/open-notifications.component.spec.ts
index 0ba4017..db335e6 100644
--- a/src/app/lists/open-notifications/open-notifications.component.spec.ts
+++ b/src/app/lists/open-notifications/open-notifications.component.spec.ts
@@ -1,7 +1,7 @@
 /* tslint:disable:no-unused-variable */
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { By } from '@angular/platform-browser';
-import { DebugElement, EventEmitter } from '@angular/core';
+import { DebugElement, EventEmitter, SimpleChange } from '@angular/core';
 import { AbstractMockObservableService } from '../../common/abstract-mock-observable.service';
 import { Notification } from '../../model/notification';
 import { click } from '../../testing/index';
@@ -27,10 +27,21 @@
 describe('OpenNotificationsComponent', () => {
   let component: OpenNotificationsComponent;
   let fixture: ComponentFixture<OpenNotificationsComponent>;
+
+  class MockEvent {
+    picker: Picker = new Picker();
+  }
+
+  class Picker {
+    startDate: string;
+    endDate: string;
+  }
+
   class MockNotificationService extends AbstractMockObservableService {
     itemChanged$ = new EventEmitter();
     itemAdded$ = new EventEmitter();
     loadCalled = false;
+
     public getOpenNotifications(notificationType: string) {
       this.loadCalled = true;
       return this;
@@ -38,10 +49,12 @@
   }
   let mockService;
   let messageService;
+  let sessionContext: SessionContext;
 
   beforeEach(async(() => {
     mockService = new MockNotificationService();
     messageService = new MessageService();
+    sessionContext = new SessionContext();
 
     TestBed.configureTestingModule({
       imports: [FormsModule],
@@ -50,7 +63,7 @@
         StringToDatePipe,
         FormattedTimestampPipe,
         MockComponent({ selector: 'app-loading-spinner' }),
-        MockComponent({ selector: 'app-sorting', inputs: ['columnName', 'initColumnName', 'isDesc', 'defaultState']})
+        MockComponent({ selector: 'app-sorting', inputs: ['columnName', 'initColumnName', 'isDesc', 'defaultState'] })
 
       ],
       providers: [
@@ -72,10 +85,12 @@
 
   it('should raise edit emitter event when EDIT clicked', async(() => {
     const resps = OPEN_NOTIFICATIONS;
-
-
     component.ngOnInit();
 
+    component.onEditNotification.subscribe(
+      (notification: Notification) => expect(notification).toBe(resps[2])
+      // the only one with status 'erledigt'! 'geschlossene' können nicht editiert werden
+    );
     mockService.subscribe(() => {
 
       messageService.matrixFilterChanged$.emit(mockService.content);
@@ -94,18 +109,19 @@
   it('should retrieve all open notifications', async(() => {
     const resps = OPEN_NOTIFICATIONS;
 
-
     component.ngOnInit();
+
     mockService.subscribe(() => {
 
       messageService.matrixFilterChanged$.emit(mockService.content);
-      fixture.detectChanges();
       fixture.whenStable().then(() => {
         const des = fixture.debugElement.queryAll(By.css('.btn-primary'));
         expect(des.length).toBe(resps.length);
       });
     });
+    
     mockService.content = resps;
+    fixture.detectChanges();
   }));
 
   it('should call getOpenNotifications after new notification added', async(() => {
@@ -130,11 +146,31 @@
   }));
 
   it('should run correctly in setError ', async(() => {
+    spyOn(console, 'log').and.callThrough();
+    const errorMsg = 'Connection Error';
     mockService.error = 'Connection Error';
     fixture.detectChanges();
+    mockService.itemAdded$.emit(DUMMY_CREATED_NOTIFICATION);
 
     fixture.whenStable().then(() => { // wait for async getResponsibilities
       fixture.detectChanges();        // update view with array
+      expect(console.log).toHaveBeenCalledWith(errorMsg);
     });
   }));
+
+  it('should call getHistoricalNotifications on ngOnChanges event', () => {
+    spyOn(component, 'getHistoricalNotifications').and.callThrough();
+    component.notificationSearchFilter = null;
+    component.shiftChangeTransactionId = 396;
+    component.ngOnChanges({
+      shiftChangeTransactionId: new SimpleChange(null, 396, false)
+    });
+
+    expect(component.getHistoricalNotifications).toHaveBeenCalled();
+    expect(component.notificationSearchFilter.shiftChangeTransactionId)
+      .toBe(component.shiftChangeTransactionId);
+  });
+
+
+
 });
diff --git a/src/app/pages/logout/logout.component.spec.ts b/src/app/pages/logout/logout.component.spec.ts
index 60805d3..350ffbc 100644
--- a/src/app/pages/logout/logout.component.spec.ts
+++ b/src/app/pages/logout/logout.component.spec.ts
@@ -39,9 +39,4 @@
     expect(component).toBeTruthy();
   });
 
-  xit('should close this browser tab on button click', async(() => {
-    
-        
-      }));
-
 });
diff --git a/src/app/pages/overview/overview.component.spec.ts b/src/app/pages/overview/overview.component.spec.ts
index 30068f3..b798227 100644
--- a/src/app/pages/overview/overview.component.spec.ts
+++ b/src/app/pages/overview/overview.component.spec.ts
@@ -324,9 +324,4 @@
     });
   }));
 
-  xit('should open the browser print function on button click', async(() => {
-    
-        
-      }));
-
   });