mirror of
https://github.com/nasa/openmct.git
synced 2025-06-11 20:01:41 +00:00
Added test for notification to CopyActionSpec
This commit is contained in:
@ -65,15 +65,15 @@ define(
|
|||||||
is shown non-invasive banner notifications at the bottom of the screen.
|
is shown non-invasive banner notifications at the bottom of the screen.
|
||||||
*/
|
*/
|
||||||
if (phase.toLowerCase() === 'preparing' && !this.dialog){
|
if (phase.toLowerCase() === 'preparing' && !this.dialog){
|
||||||
this.dialog = self.dialogService.showBlockingMessage({
|
this.dialog = this.dialogService.showBlockingMessage({
|
||||||
title: "Preparing to copy objects",
|
title: "Preparing to copy objects",
|
||||||
unknownProgress: true,
|
unknownProgress: true,
|
||||||
severity: "info",
|
severity: "info",
|
||||||
});
|
});
|
||||||
} else if (phase.toLowerCase() === "copying") {
|
} else if (phase.toLowerCase() === "copying") {
|
||||||
self.dialogService.dismiss();
|
this.dialogService.dismiss();
|
||||||
if (!notification) {
|
if (!this.notification) {
|
||||||
this.notification = self.notificationService
|
this.notification = this.notificationService
|
||||||
.notify({
|
.notify({
|
||||||
title: "Copying objects",
|
title: "Copying objects",
|
||||||
unknownProgress: false,
|
unknownProgress: false,
|
||||||
@ -111,7 +111,7 @@ define(
|
|||||||
|
|
||||||
},
|
},
|
||||||
function notification(notification){
|
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,
|
notification,
|
||||||
dialogService,
|
dialogService,
|
||||||
mockLog,
|
mockLog,
|
||||||
abstractComposePromise;
|
abstractComposePromise,
|
||||||
|
progress = {phase: "copying", totalObjects: 10, processed: 1};
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
selectedObjectContextCapability = jasmine.createSpyObj(
|
selectedObjectContextCapability = jasmine.createSpyObj(
|
||||||
@ -100,7 +101,7 @@ define(
|
|||||||
);
|
);
|
||||||
|
|
||||||
abstractComposePromise.then.andCallFake(function(success, error, notify){
|
abstractComposePromise.then.andCallFake(function(success, error, notify){
|
||||||
notify({phase: "copying", totalObjects: 10, processed: 10});
|
notify(progress);
|
||||||
success();
|
success();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -115,23 +116,23 @@ define(
|
|||||||
.andReturn(locationServicePromise);
|
.andReturn(locationServicePromise);
|
||||||
|
|
||||||
dialogService = jasmine.createSpyObj('dialogService',
|
dialogService = jasmine.createSpyObj('dialogService',
|
||||||
['showBlockingMessage']
|
['showBlockingMessage', 'dismiss']
|
||||||
);
|
);
|
||||||
dialogService.showBlockingMessage.andReturn();
|
//dialogService.showBlockingMessage.andReturn();
|
||||||
|
|
||||||
notification = jasmine.createSpyObj('notification',
|
notification = jasmine.createSpyObj('notification',
|
||||||
['dismiss', 'model']
|
['dismiss', 'model']
|
||||||
);
|
);
|
||||||
notification.dismiss.andReturn();
|
//notification.dismiss.andReturn();
|
||||||
|
|
||||||
notificationService = jasmine.createSpyObj('notificationService',
|
notificationService = jasmine.createSpyObj('notificationService',
|
||||||
['notify']
|
['notify', 'info']
|
||||||
);
|
);
|
||||||
|
|
||||||
notificationService.notify.andReturn(notification);
|
notificationService.notify.andReturn(notification);
|
||||||
|
|
||||||
mockLog = jasmine.createSpyObj('log', ['error']);
|
mockLog = jasmine.createSpyObj('log', ['error']);
|
||||||
mockLog.error.andReturn();
|
//mockLog.error.andReturn();
|
||||||
|
|
||||||
copyService = new MockCopyService();
|
copyService = new MockCopyService();
|
||||||
});
|
});
|
||||||
@ -189,7 +190,7 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("notifies the user of progress", function(){
|
it("notifies the user of progress", function(){
|
||||||
expect(copyAction.progress.calls.length).toBeGreaterThan(0)
|
expect(notificationService.info).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user