diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 13b005958e..a48ceec996 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -62,7 +62,7 @@ define( } function cancel(allowed) { - return allowed && domainObject.getCapability("editor").cancel(); + return allowed && domainObject.getCapability("editor").finish(); } //Do navigation first in order to trigger unsaved changes dialog diff --git a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js index a6a1eb9e62..6145ecd05b 100644 --- a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js +++ b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js @@ -52,7 +52,7 @@ define( saveAction = new SaveAction(this.dialogService, this.context); function closeEditor() { - return domainObject.getCapability("editor").cancel(); + return domainObject.getCapability("editor").finish(); } return saveAction.perform() diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index a997eb3033..53dea8c91c 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -95,11 +95,11 @@ define( EditorCapability.prototype.invoke = EditorCapability.prototype.edit; /** - * Cancel the current editing session. This will discard any pending + * Finish the current editing session. This will discard any pending * persist operations * @returns {*} */ - EditorCapability.prototype.cancel = function () { + EditorCapability.prototype.finish = function () { var domainObject = this.domainObject; return this.transactionService.cancel().then(function () { domainObject.getCapability("status").set("editing", false); diff --git a/platform/commonUI/edit/test/actions/CancelActionSpec.js b/platform/commonUI/edit/test/actions/CancelActionSpec.js index 3bd0cee72f..7fdc51b0e9 100644 --- a/platform/commonUI/edit/test/actions/CancelActionSpec.js +++ b/platform/commonUI/edit/test/actions/CancelActionSpec.js @@ -63,7 +63,7 @@ define( capabilities.editor = jasmine.createSpyObj( "editor", - ["save", "cancel", "isEditContextRoot"] + ["save", "finish", "isEditContextRoot"] ); capabilities.action = jasmine.createSpyObj( "actionCapability", @@ -105,7 +105,7 @@ define( return !!capabilities[name]; }); - capabilities.editor.cancel.andReturn(mockPromise(true)); + capabilities.editor.finish.andReturn(mockPromise(true)); action = new CancelAction(actionContext); @@ -130,8 +130,8 @@ define( capabilities.action.perform.andReturn(mockPromise(true)); action.perform(); - // Should have called cancel - expect(capabilities.editor.cancel).toHaveBeenCalled(); + // Should have called finish + expect(capabilities.editor.finish).toHaveBeenCalled(); // Definitely shouldn't call save! expect(capabilities.editor.save).not.toHaveBeenCalled(); diff --git a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js index a5d14e3d6d..6570dd6037 100644 --- a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js @@ -57,7 +57,7 @@ define( ); mockEditorCapability = jasmine.createSpyObj( "editor", - ["save", "cancel", "isEditContextRoot"] + ["save", "finish", "isEditContextRoot"] ); mockActionCapability = jasmine.createSpyObj( "actionCapability", @@ -105,13 +105,13 @@ define( })); action.perform(); expect(mockEditorCapability.save).toHaveBeenCalled(); - expect(mockEditorCapability.cancel).not.toHaveBeenCalled(); + expect(mockEditorCapability.finish).not.toHaveBeenCalled(); }); it("closes the editor after saving", function () { action.perform(); expect(mockEditorCapability.save).toHaveBeenCalled(); - expect(mockEditorCapability.cancel).toHaveBeenCalled(); + expect(mockEditorCapability.finish).toHaveBeenCalled(); }); }); } diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index e72793be53..77fbd9b74f 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -139,10 +139,10 @@ define( }); }); - describe("cancel", function () { + describe("finish", function () { beforeEach(function () { capability.edit(); - capability.cancel(); + capability.finish(); }); it("cancels the transaction", function () { expect(mockTransactionService.cancel).toHaveBeenCalled(); @@ -158,7 +158,7 @@ define( beforeEach(function () { mockDomainObject.getModel.andReturn(model); capability.edit(); - capability.cancel(); + capability.finish(); }); it("returns true if the object has been modified since it" + " was last persisted", function () {