Some modifications in sidebar components 40/109140/1
authorIndrijeet kumar <indriku1@in.ibm.com>
Sun, 14 Jun 2020 18:41:03 +0000 (00:11 +0530)
committerIndrijeet kumar <indriku1@in.ibm.com>
Sun, 14 Jun 2020 18:41:17 +0000 (00:11 +0530)
some modifications in sidebar components

Issue-ID: PORTAL-813
Change-Id: Iad3a258ec888d0c0f1390931134feafff18a1b9b
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts

index 9bbcfc4..eaa6a07 100644 (file)
@@ -59,10 +59,6 @@ describe('SidebarComponent', () => {
     "data":'"d"',
     "data2":'"data2"'
      };
-     var stubData2={
-      "data":'"d"',
-      "data2":'" "'
-       };
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
@@ -94,17 +90,15 @@ describe('SidebarComponent', () => {
     it('should validate on ngOnInit',()=>{
      let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData1));
      component.ngOnInit();
+     expect(component.isActive).toEqual(false);
+     expect(component.collapsed).toEqual(false);
+     expect(component.showMenu).toEqual('');
+     expect(component.pushRightClass).toEqual('push-right');
+     expect(component.leftParentData).toEqual(JSON.parse(component.result.data));
+     expect(component.leftChildData).toEqual(JSON.parse(component.result.data2));
      expect(spy).toHaveBeenCalled();  
     })
-  })
-
-  //describe('should test ngOnInit if part',()=>{
-    //it('should validate on ngOnInit',()=>{
-     //let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData2));
-    // component.ngOnInit();
-     //expect(spy).toHaveBeenCalled();  
-    //})
-  //})
+  });
 
   it('should test addExpandClass if element and showMenu variable value are same', () => {
     component.showMenu= '1';
@@ -132,15 +126,15 @@ describe('SidebarComponent', () => {
 
   it('should test isToggled method',()=>{
     expect(component.isToggled()).toBe(false);  
-  })
+  });
 
   it('should test toggleSidebar method',()=>{
     component.pushRightClass="kumar";
     expect(component.toggleSidebar()).toBeUndefined;
-  })
+  });
 
   it('should test on onLoggedout method',()=>{
      expect(localStorage.getItem('isLoggedin')).toBeFalsy
-    })
+    });
 
 });