mirror of
https://github.com/nasa/openmct.git
synced 2025-04-22 18:11:23 +00:00
[Edit] CreateAction closes editor after save
This commit is contained in:
parent
d87ed1414e
commit
0be84a4e51
@ -103,7 +103,6 @@ define(
|
||||
var domainObject = this.domainObject;
|
||||
return this.transactionService.cancel().then(function () {
|
||||
domainObject.getCapability("status").set("editing", false);
|
||||
return domainObject;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -67,12 +67,17 @@ define(
|
||||
editAction,
|
||||
editorCapability;
|
||||
|
||||
function closeEditor() {
|
||||
return editorCapability.finish();
|
||||
}
|
||||
|
||||
function onSave() {
|
||||
return editorCapability.save();
|
||||
return editorCapability.save()
|
||||
.then(closeEditor);
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
return editorCapability.finish();
|
||||
return closeEditor();
|
||||
}
|
||||
|
||||
newModel.type = this.type.getKey();
|
||||
|
@ -142,6 +142,7 @@ define(
|
||||
});
|
||||
|
||||
describe("the perform function", function () {
|
||||
var promise = jasmine.createSpyObj("promise", ["then"]);
|
||||
beforeEach(function () {
|
||||
capabilities.action.getActions.andReturn([mockEditAction]);
|
||||
});
|
||||
@ -160,15 +161,16 @@ define(
|
||||
" available", function () {
|
||||
capabilities.action.getActions.andReturn([]);
|
||||
capabilities.action.perform.andReturn(mockPromise(undefined));
|
||||
capabilities.editor.save.andReturn(promise);
|
||||
action.perform();
|
||||
expect(capabilities.action.perform).toHaveBeenCalledWith("save");
|
||||
});
|
||||
|
||||
describe("uses to editor capability", function () {
|
||||
var promise = jasmine.createSpyObj("promise", ["then"]);
|
||||
beforeEach(function () {
|
||||
capabilities.action.getActions.andReturn([]);
|
||||
capabilities.action.perform.andReturn(promise);
|
||||
capabilities.editor.save.andReturn(promise);
|
||||
});
|
||||
|
||||
it("to save the edit if user saves dialog", function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user