diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 1cbf239d7d..2ea532f6a6 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -103,7 +103,6 @@ define( var domainObject = this.domainObject; return this.transactionService.cancel().then(function () { domainObject.getCapability("status").set("editing", false); - return domainObject; }); }; diff --git a/platform/commonUI/edit/src/creation/CreateAction.js b/platform/commonUI/edit/src/creation/CreateAction.js index 3cfbdb0ef9..711e4001a6 100644 --- a/platform/commonUI/edit/src/creation/CreateAction.js +++ b/platform/commonUI/edit/src/creation/CreateAction.js @@ -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(); diff --git a/platform/commonUI/edit/test/creation/CreateActionSpec.js b/platform/commonUI/edit/test/creation/CreateActionSpec.js index 19dc46896f..60040b5410 100644 --- a/platform/commonUI/edit/test/creation/CreateActionSpec.js +++ b/platform/commonUI/edit/test/creation/CreateActionSpec.js @@ -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 () {