[Edit] CreateAction closes editor after save

This commit is contained in:
Alex M 2016-09-13 23:59:28 +03:00
parent d87ed1414e
commit 0be84a4e51
3 changed files with 10 additions and 4 deletions

View File

@ -103,7 +103,6 @@ define(
var domainObject = this.domainObject;
return this.transactionService.cancel().then(function () {
domainObject.getCapability("status").set("editing", false);
return domainObject;
});
};

View File

@ -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();

View File

@ -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 () {