Tobias Jeger pushed to branch feature/delete-channel at cms-community / hippo-addon-channel-manager
Commits: 804c990b by Tobias Jeger at 2016-09-06T15:29:04+02:00 CHANNELMGR-797 Get rid of ghost button in channel delete alert. - - - - - 4 changed files: - frontend-ng/src/angularjs/api/dialog.service.js - frontend-ng/src/angularjs/api/dialog.service.spec.js - frontend-ng/src/angularjs/channel/actions/channelActions.controller.js - frontend-ng/src/angularjs/channel/actions/channelActions.spec.js Changes: ===================================== frontend-ng/src/angularjs/api/dialog.service.js ===================================== --- a/frontend-ng/src/angularjs/api/dialog.service.js +++ b/frontend-ng/src/angularjs/api/dialog.service.js @@ -28,6 +28,12 @@ export class DialogService { }); } + alert() { + return this.$mdDialog.alert({ + onRemoving: () => this._removeMask(), + }); + } + show(dialog) { this._showMask(); ===================================== frontend-ng/src/angularjs/api/dialog.service.spec.js ===================================== --- a/frontend-ng/src/angularjs/api/dialog.service.spec.js +++ b/frontend-ng/src/angularjs/api/dialog.service.spec.js @@ -35,6 +35,12 @@ describe('DialogService', () => { expect(DialogService.confirm()).toEqual(mockDialogPreset); }); + it('uses $mdDialog to create a alert dialog', () => { + const mockDialogPreset = {}; + spyOn($mdDialog, 'alert').and.returnValue(mockDialogPreset); + expect(DialogService.alert()).toEqual(mockDialogPreset); + }); + it('uses $mdDialog to show a confirmation dialog', () => { spyOn($mdDialog, 'show'); const confirmationDialog = DialogService.confirm(); ===================================== frontend-ng/src/angularjs/channel/actions/channelActions.controller.js ===================================== --- a/frontend-ng/src/angularjs/channel/actions/channelActions.controller.js +++ b/frontend-ng/src/angularjs/channel/actions/channelActions.controller.js @@ -91,11 +91,11 @@ export class ChannelActionsCtrl { } _showElaborateFeedback(response, key) { - const confirm = this.DialogService.confirm() + const alert = this.DialogService.alert() .title(this.$translate.instant('ERROR_CHANNEL_DELETE_FAILED')) .textContent(this.$translate.instant(key, response.parameterMap)) .ok(this.$translate.instant('OK')); - this.DialogService.show(confirm); + this.DialogService.show(alert); } } ===================================== frontend-ng/src/angularjs/channel/actions/channelActions.spec.js ===================================== --- a/frontend-ng/src/angularjs/channel/actions/channelActions.spec.js +++ b/frontend-ng/src/angularjs/channel/actions/channelActions.spec.js @@ -56,6 +56,7 @@ describe('ChannelActions', () => { spyOn(ChannelService, 'getName').and.returnValue('test-channel'); spyOn(ChannelService, 'deleteChannel').and.returnValue($q.when()); spyOn(DialogService, 'confirm').and.returnValue(confirmDialog); + spyOn(DialogService, 'alert').and.returnValue(confirmDialog); spyOn(DialogService, 'hide'); spyOn(DialogService, 'show').and.returnValue($q.when()); spyOn(FeedbackService, 'showErrorResponse'); @@ -173,6 +174,7 @@ describe('ChannelActions', () => { $rootScope.$digest(); expect(DialogService.hide).toHaveBeenCalled(); + expect(DialogService.alert).toHaveBeenCalled(); expect($translate.instant).toHaveBeenCalledWith('ERROR_CHANNEL_DELETE_FAILED_DUE_TO_CHILD_MOUNTS', parameterMap); }); View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/804c990bccbd8729af4f8fdc7ce2048901eca3c5
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn