Added test for notification to CopyActionSpec

This commit is contained in:
Andrew Henry 2015-11-04 20:12:36 -08:00
parent 7d1a1acc11
commit 529dde57b9
2 changed files with 14 additions and 13 deletions

View File

@ -65,15 +65,15 @@ define(
is shown non-invasive banner notifications at the bottom of the screen.
*/
if (phase.toLowerCase() === 'preparing' && !this.dialog){
this.dialog = self.dialogService.showBlockingMessage({
this.dialog = this.dialogService.showBlockingMessage({
title: "Preparing to copy objects",
unknownProgress: true,
severity: "info",
});
} else if (phase.toLowerCase() === "copying") {
self.dialogService.dismiss();
if (!notification) {
this.notification = self.notificationService
this.dialogService.dismiss();
if (!this.notification) {
this.notification = this.notificationService
.notify({
title: "Copying objects",
unknownProgress: false,
@ -111,7 +111,7 @@ define(
},
function notification(notification){
this.progress(notification.phase, notification.totalObjects, notification.processed);
self.progress(notification.phase, notification.totalObjects, notification.processed);
}
);
};

View File

@ -46,7 +46,8 @@ define(
notification,
dialogService,
mockLog,
abstractComposePromise;
abstractComposePromise,
progress = {phase: "copying", totalObjects: 10, processed: 1};
beforeEach(function () {
selectedObjectContextCapability = jasmine.createSpyObj(
@ -100,7 +101,7 @@ define(
);
abstractComposePromise.then.andCallFake(function(success, error, notify){
notify({phase: "copying", totalObjects: 10, processed: 10});
notify(progress);
success();
}
)
@ -115,23 +116,23 @@ define(
.andReturn(locationServicePromise);
dialogService = jasmine.createSpyObj('dialogService',
['showBlockingMessage']
['showBlockingMessage', 'dismiss']
);
dialogService.showBlockingMessage.andReturn();
//dialogService.showBlockingMessage.andReturn();
notification = jasmine.createSpyObj('notification',
['dismiss', 'model']
);
notification.dismiss.andReturn();
//notification.dismiss.andReturn();
notificationService = jasmine.createSpyObj('notificationService',
['notify']
['notify', 'info']
);
notificationService.notify.andReturn(notification);
mockLog = jasmine.createSpyObj('log', ['error']);
mockLog.error.andReturn();
//mockLog.error.andReturn();
copyService = new MockCopyService();
});
@ -189,7 +190,7 @@ define(
});
it("notifies the user of progress", function(){
expect(copyAction.progress.calls.length).toBeGreaterThan(0)
expect(notificationService.info).toHaveBeenCalled();
});
});