mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 06:27:48 +00:00
Added test for notification to CopyActionSpec
This commit is contained in:
parent
7d1a1acc11
commit
529dde57b9
@ -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);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user