Joeri de Gooijer pushed to branch feature/cmng-psp1-CHANNELMGR-671 at cms-community / hippo-addon-channel-manager
Commits: 727cf02a by Joeri de Gooijer at 2016-05-24T13:33:40+02:00 CHANNELMGR-671 fix merge - - - - - 4 changed files: - frontend-ng/src/angularjs/channel/actions/settings/settings.controller.js - frontend-ng/src/angularjs/channel/actions/settings/settings.spec.js - frontend-ng/src/angularjs/channel/changes/manageChanges.controller.js - frontend-ng/src/angularjs/channel/changes/manageChanges.spec.js Changes: ===================================== frontend-ng/src/angularjs/channel/actions/settings/settings.controller.js ===================================== --- a/frontend-ng/src/angularjs/channel/actions/settings/settings.controller.js +++ b/frontend-ng/src/angularjs/channel/actions/settings/settings.controller.js @@ -26,6 +26,8 @@ export class ChannelSettingsCtrl { ChannelService.reload() .then(() => this._initialize()); + + this.channelInfoDescription = {}; } _initialize() { @@ -37,7 +39,7 @@ export class ChannelSettingsCtrl { .then((channelInfoDescription) => { this.channelInfoDescription = channelInfoDescription; if (this.isLockedByOther()) { - this._showError('ERROR_CHANNEL_SETTINGS_READONLY', { lockedBy: channelInfoDescription.lockedBy }); + this.FeedbackService.showErrorOnSubpage('ERROR_CHANNEL_SETTINGS_READONLY', { lockedBy: channelInfoDescription.lockedBy }); } }) .catch(() => { ===================================== frontend-ng/src/angularjs/channel/actions/settings/settings.spec.js ===================================== --- a/frontend-ng/src/angularjs/channel/actions/settings/settings.spec.js +++ b/frontend-ng/src/angularjs/channel/actions/settings/settings.spec.js @@ -114,6 +114,7 @@ describe('ChannelSettings', () => { $compile($element)($scope); $scope.$digest(); + return $element.controller('channel-settings'); } @@ -178,18 +179,17 @@ describe('ChannelSettings', () => { it('displays an alert message when the current channel is locked', () => { ConfigService.cmsUser = 'admin'; channelInfoDescription.lockedBy = 'tester'; - const ChannelSettingsCtrl = compileDirectiveAndGetController(); - expect(FeedbackService.showError).toHaveBeenCalledWith('ERROR_CHANNEL_SETTINGS_READONLY', { lockedBy: 'tester' }, - ChannelSettingsCtrl.feedbackParent); + compileDirectiveAndGetController(); + expect(FeedbackService.showErrorOnSubpage).toHaveBeenCalledWith('ERROR_CHANNEL_SETTINGS_READONLY', { lockedBy: 'tester' }); - FeedbackService.showError.calls.reset(); + FeedbackService.showErrorOnSubpage.calls.reset(); channelInfoDescription.lockedBy = 'admin'; compileDirectiveAndGetController(); - expect(FeedbackService.showError).not.toHaveBeenCalled(); + expect(FeedbackService.showErrorOnSubpage).not.toHaveBeenCalled(); - FeedbackService.showError.calls.reset(); + FeedbackService.showErrorOnSubpage.calls.reset(); delete channelInfoDescription.lockedBy; compileDirectiveAndGetController(); - expect(FeedbackService.showError).not.toHaveBeenCalled(); + expect(FeedbackService.showErrorOnSubpage).not.toHaveBeenCalled(); }); }); ===================================== frontend-ng/src/angularjs/channel/changes/manageChanges.controller.js ===================================== --- a/frontend-ng/src/angularjs/channel/changes/manageChanges.controller.js +++ b/frontend-ng/src/angularjs/channel/changes/manageChanges.controller.js @@ -122,6 +122,6 @@ export class ChangeManagementCtrl { response = response || {}; this.$log.info(response.message); - this.FeedbackService.showError(key, response.data, this.feedbackParent); + this.FeedbackService.showErrorOnSubpage(key, response.data); } } ===================================== frontend-ng/src/angularjs/channel/changes/manageChanges.spec.js ===================================== --- a/frontend-ng/src/angularjs/channel/changes/manageChanges.spec.js +++ b/frontend-ng/src/angularjs/channel/changes/manageChanges.spec.js @@ -158,8 +158,7 @@ describe('ChangeManagement', () => { ChangeManagementCtrl.publishAllChanges(); $rootScope.$apply(); - expect(FeedbackService.showError).toHaveBeenCalledWith('ERROR_CHANGE_PUBLICATION_FAILED', params, - ChangeManagementCtrl.feedbackParent); + expect(FeedbackService.showErrorOnSubpage).toHaveBeenCalledWith('ERROR_CHANGE_PUBLICATION_FAILED', params); expect($scope.onDone).not.toHaveBeenCalled(); ChannelService.publishChanges.and.returnValue($q.reject()); @@ -167,8 +166,7 @@ describe('ChangeManagement', () => { ChangeManagementCtrl.publishChanges('testuser'); $rootScope.$apply(); - expect(FeedbackService.showError).toHaveBeenCalledWith('ERROR_CHANGE_PUBLICATION_FAILED', undefined, - ChangeManagementCtrl.feedbackParent); + expect(FeedbackService.showErrorOnSubpage).toHaveBeenCalledWith('ERROR_CHANGE_PUBLICATION_FAILED', undefined); }); it('should show a toast when discarding of the changes fails', () => { @@ -178,8 +176,7 @@ describe('ChangeManagement', () => { ChangeManagementCtrl.discardAllChanges(); $rootScope.$apply(); - expect(FeedbackService.showError).toHaveBeenCalledWith('ERROR_CHANGE_DISCARD_FAILED', params, - ChangeManagementCtrl.feedbackParent); + expect(FeedbackService.showErrorOnSubpage).toHaveBeenCalledWith('ERROR_CHANGE_DISCARD_FAILED', params); expect($scope.onDone).not.toHaveBeenCalled(); ChannelService.discardChanges.and.returnValue($q.reject()); @@ -187,8 +184,7 @@ describe('ChangeManagement', () => { ChangeManagementCtrl.discardChanges('testuser'); $rootScope.$apply(); - expect(FeedbackService.showError).toHaveBeenCalledWith('ERROR_CHANGE_DISCARD_FAILED', undefined, - ChangeManagementCtrl.feedbackParent); + expect(FeedbackService.showErrorOnSubpage).toHaveBeenCalledWith('ERROR_CHANGE_DISCARD_FAILED', undefined); }); it('should add a suffix to the current user\'s label', () => { View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/727cf02ab5f66e58582188c619d61f291dc4adcd
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn