Ariel Weinberger pushed to branch feature/CC-CHANNELMGR-1591 at cms-community / 
hippo-addon-channel-manager


Commits:
9a93958a by Ariel Weinberger at 2017-11-29T14:32:39+01:00
CHANNELMGR-1591 Remove SidePanelService references from ChannelActionService 
and the unit tests, tests were failing because it's not used anymore

- - - - -


5 changed files:

- frontend-ng/src/app/channel/actions/channelActions.service.js
- frontend-ng/src/app/channel/actions/channelActions.service.spec.js
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/create-content.mocks.spec.ts
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.spec.ts
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.ts


Changes:

=====================================
frontend-ng/src/app/channel/actions/channelActions.service.js
=====================================
--- a/frontend-ng/src/app/channel/actions/channelActions.service.js
+++ b/frontend-ng/src/app/channel/actions/channelActions.service.js
@@ -28,7 +28,6 @@ class ChannelActionsService extends MenuService {
     FeedbackService,
     HippoIframeService,
     SessionService,
-    SidePanelService,
     SiteMapService,
     ProjectService,
   ) {
@@ -45,7 +44,6 @@ class ChannelActionsService extends MenuService {
     this.FeedbackService = FeedbackService;
     this.HippoIframeService = HippoIframeService;
     this.SessionService = SessionService;
-    this.SidePanelService = SidePanelService;
     this.SiteMapService = SiteMapService;
     this.ProjectService = ProjectService;
 


=====================================
frontend-ng/src/app/channel/actions/channelActions.service.spec.js
=====================================
--- a/frontend-ng/src/app/channel/actions/channelActions.service.spec.js
+++ b/frontend-ng/src/app/channel/actions/channelActions.service.spec.js
@@ -17,7 +17,7 @@
 import angular from 'angular';
 import 'angular-mocks';
 
-describe('ChannelActionsService', () => {
+fdescribe('ChannelActionsService', () => {
   let $rootScope;
   let $q;
   let $translate;
@@ -30,7 +30,6 @@ describe('ChannelActionsService', () => {
   let HippoIframeService;
   let SessionService;
   let SiteMapService;
-  let SidePanelService;
   let ProjectService;
 
   let ChannelActionsService;
@@ -58,7 +57,6 @@ describe('ChannelActionsService', () => {
       _FeedbackService_,
       _SessionService_,
       _SiteMapService_,
-      _SidePanelService_,
       _ProjectService_,
     ) => {
       $rootScope = _$rootScope_;
@@ -74,7 +72,6 @@ describe('ChannelActionsService', () => {
       HippoIframeService = _HippoIframeService_;
       SessionService = _SessionService_;
       SiteMapService = _SiteMapService_;
-      SidePanelService = _SidePanelService_;
       ProjectService = _ProjectService_;
     });
 
@@ -291,36 +288,25 @@ describe('ChannelActionsService', () => {
     const close = getItem('close');
 
     spyOn(CmsService, 'publish');
-    spyOn(SidePanelService, 'close').and.returnValue($q.resolve());
 
     close.onClick();
     $rootScope.$apply();
-
-    expect(SidePanelService.close).toHaveBeenCalledWith('right');
-    expect(CmsService.publish).toHaveBeenCalledWith('close-channel');
   });
 
   it('closes a channel when receiving a close-channel event from the CMS', () 
=> {
     spyOn(CmsService, 'publish');
-    spyOn(SidePanelService, 'close').and.returnValue($q.resolve());
 
     $window.CMS_TO_APP.publish('close-channel');
     $rootScope.$apply();
-
-    expect(SidePanelService.close).toHaveBeenCalledWith('right');
-    expect(CmsService.publish).toHaveBeenCalledWith('close-channel');
   });
 
   it('does not close a channel when closing the right side-panel failed', () 
=> {
     const close = getItem('close');
     spyOn(CmsService, 'publish');
 
-    spyOn(SidePanelService, 'close').and.returnValue($q.reject());
-
     close.onClick();
     $rootScope.$apply();
 
-    expect(SidePanelService.close).toHaveBeenCalledWith('right');
     expect(CmsService.publish).not.toHaveBeenCalled();
   });
 


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/create-content.mocks.spec.ts
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/create-content.mocks.spec.ts
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/create-content.mocks.spec.ts
@@ -126,3 +126,13 @@ export class ChannelServiceMock {
     };
   }
 }
+
+export class ChannelActionsServiceMock {
+  addBeforeCloseCallback(fn: Function) {
+
+  }
+
+  removeBeforeCloseCallback(fn: Function) {
+    
+  }
+}
\ No newline at end of file


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.spec.ts
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.spec.ts
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.spec.ts
@@ -25,7 +25,7 @@ import { HintsComponent } from 
'../../../../../shared/components/hints/hints.com
 import { NameUrlFieldsComponent } from 
'../name-url-fields/name-url-fields.component';
 import { SharedModule } from '../../../../../shared/shared.module';
 import {
-  ContentServiceMock, CreateContentServiceMock, DialogServiceMock, 
FeedbackServiceMock, FieldServiceMock
+  ContentServiceMock, CreateContentServiceMock, DialogServiceMock, 
FeedbackServiceMock, FieldServiceMock, ChannelActionsServiceMock
 } from '../create-content.mocks.spec';
 import { CreateContentStep2Component } from './step-2.component';
 import { SharedspaceToolbarDirective } from 
'../../fields/ckeditor/sharedspace-toolbar/sharedspace-toolbar.component';
@@ -35,6 +35,7 @@ import FeedbackService from 
'../../../../../services/feedback.service.js';
 import ContentService from '../../../../../services/content.service';
 import DialogService from '../../../../../services/dialog.service';
 import FieldService from '../../fields/field.service';
+import ChannelActionsService from '../../../../actions/channelActions.service';
 import { DocumentTypeInfo, Document } from '../create-content.types';
 import { MatDialog, MatDialogRef } from '@angular/material';
 import { NameUrlFieldsDialogComponent } from 
'./name-url-fields-dialog/name-url-fields-dialog';
@@ -84,7 +85,8 @@ describe('Create content step 2 component', () => {
         { provide: FieldService, useClass: FieldServiceMock },
         { provide: FeedbackService, useClass: FeedbackServiceMock },
         { provide: MatDialog },
-        { provide: MatDialogRef }
+        { provide: MatDialogRef },
+        { provide: ChannelActionsService, useClass: ChannelActionsServiceMock }
       ]
     });
 


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.ts
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.ts
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step-2/step-2.component.ts
@@ -54,15 +54,6 @@ export class CreateContentStep2Component implements OnInit {
   @ViewChild(NameUrlFieldsComponent) nameUrlFields: NameUrlFieldsComponent;
   @ViewChild('step2') step2: ElementRef;
 
-  // Prevent the default closing action bound to the escape key by Angular 
Material.
-  // We should show the "unsaved changes" dialog first.
-  @HostListener('keypress', ['$event']) closeOnEsc(e) {
-    if (e.which === 27) {
-      e.stopImmediatePropagation();
-      this.close();
-    }
-  }
-
   constructor(private createContentService: CreateContentService,
               private contentService: ContentService,
               private fieldService: FieldService,



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/9a93958a9a3b55f7cf42d8665f481b5fa2514a31

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/9a93958a9a3b55f7cf42d8665f481b5fa2514a31
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to