Ariel Weinberger pushed to branch feature/CC-CHANNELMGR-1591 at cms-community / hippo-addon-channel-manager
Commits: 7e1ce830 by Ariel Weinberger at 2017-11-29T15:26:30+01:00 CHANNELMGR-1591 Fix broken unit tests in rightSidePanel controller - - - - - 3 changed files: - frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.spec.js - frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js - frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.spec.js Changes: ===================================== frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.spec.js ===================================== --- a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.spec.js +++ b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.spec.js @@ -14,7 +14,7 @@ * limitations under the License. */ -fdescribe('editContent', () => { +describe('editContent', () => { let $componentController; let $q; let $rootScope; ===================================== frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js ===================================== --- a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js +++ b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js @@ -142,8 +142,6 @@ class RightSidePanelCtrl { throw new Error(`Failed to open rightside panel in mode ${id}`); } - console.log('rightSidePanel._onOpen, options: ' + options); - this.openInMode(this.modes[id], options).then(() => { this.$element.addClass('sidepanel-open'); this.$element.css('width', this.lastSavedWidth); ===================================== frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.spec.js ===================================== --- a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.spec.js +++ b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.spec.js @@ -112,7 +112,7 @@ describe('RightSidePanel', () => { it('initializes the channel right side panel service', () => { expect(SidePanelService.initialize).toHaveBeenCalled(); - expect($ctrl.options).not.toBeDefined(); + expect($ctrl.options).toBe(null); expect($ctrl.editing).not.toBeDefined(); expect($ctrl.creating).not.toBeDefined(); }); @@ -125,7 +125,7 @@ describe('RightSidePanel', () => { sidePanelHandlers.onOpen('create'); $rootScope.$digest(); - expect($ctrl._resetState).toHaveBeenCalledTimes(2); + expect($ctrl._resetState).toHaveBeenCalledTimes(1); }); it('initializes "edit" component when calling onOpen with id "edit"', () => { @@ -159,14 +159,14 @@ describe('RightSidePanel', () => { $ctrl.mode = $ctrl.modes.edit; const spy = spyOn($ctrl, 'beforeStateChange'); - $ctrl._onOpen('edit', testId); + $ctrl._onOpen('edit', 'test'); expect(spy).not.toHaveBeenCalled(); }); it('opens a new document if beforeStateChange is resolved', () => { $ctrl.options = 'test'; $ctrl.mode = $ctrl.modes.edit; - spyOn($ctrl, 'beforeStateChange'); + spyOn($ctrl, 'beforeStateChange').and.callThrough(); $ctrl.beforeStateChange.and.returnValue($q.resolve()); $ctrl._onOpen('edit', testId); $rootScope.$digest(); @@ -241,7 +241,7 @@ describe('RightSidePanel', () => { it('sets and unsets a onBeforeStateChange callback', () => { const firstCallback = jasmine.createSpy('firstCallback', () => $q.resolve()).and.callThrough(); $ctrl.onBeforeStateChange(firstCallback); - $ctrl._onOpen('edit', null); + $ctrl._onOpen('edit', 'someTestId'); expect(firstCallback).toHaveBeenCalled(); SidePanelService.close.and.returnValue($q.resolve()); $ctrl.closePanel(); View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/7e1ce8308c5aab34aaacd4a3aa3afa01dbf0bbf1 --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/7e1ce8308c5aab34aaacd4a3aa3afa01dbf0bbf1 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