[Edit] Final two actions now use finish()
This commit is contained in:
@@ -71,7 +71,7 @@ define(
|
|||||||
EditAction.prototype.perform = function () {
|
EditAction.prototype.perform = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
function cancelEditing() {
|
function cancelEditing() {
|
||||||
self.domainObject.getCapability('editor').cancel();
|
self.domainObject.getCapability('editor').finish();
|
||||||
self.navigationService.removeListener(cancelEditing);
|
self.navigationService.removeListener(cancelEditing);
|
||||||
}
|
}
|
||||||
//If this is not the currently navigated object, then navigate
|
//If this is not the currently navigated object, then navigate
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onCancel() {
|
function onCancel() {
|
||||||
return editorCapability.cancel();
|
return editorCapability.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
newModel.type = this.type.getKey();
|
newModel.type = this.type.getKey();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ define(
|
|||||||
);
|
);
|
||||||
mockEditor = jasmine.createSpyObj(
|
mockEditor = jasmine.createSpyObj(
|
||||||
"editorCapability",
|
"editorCapability",
|
||||||
["edit", "isEditContextRoot", "cancel"]
|
["edit", "isEditContextRoot", "finish"]
|
||||||
);
|
);
|
||||||
|
|
||||||
capabilities = {
|
capabilities = {
|
||||||
@@ -98,11 +98,11 @@ define(
|
|||||||
expect(EditAction.appliesTo(actionContext)).toBe(false);
|
expect(EditAction.appliesTo(actionContext)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("cancels editing when user navigates away", function () {
|
it ("finishes editing when user navigates away", function () {
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(mockNavigationService.addListener).toHaveBeenCalled();
|
expect(mockNavigationService.addListener).toHaveBeenCalled();
|
||||||
mockNavigationService.addListener.mostRecentCall.args[0]();
|
mockNavigationService.addListener.mostRecentCall.args[0]();
|
||||||
expect(mockEditor.cancel).toHaveBeenCalled();
|
expect(mockEditor.finish).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("invokes the Edit capability on the object", function () {
|
it ("invokes the Edit capability on the object", function () {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ define(
|
|||||||
[
|
[
|
||||||
"edit",
|
"edit",
|
||||||
"save",
|
"save",
|
||||||
"cancel"
|
"finish"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -178,10 +178,10 @@ define(
|
|||||||
expect(capabilities.editor.save).toHaveBeenCalled();
|
expect(capabilities.editor.save).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("to cancel the edit if user cancels dialog", function () {
|
it("to finish the edit if user cancels dialog", function () {
|
||||||
action.perform();
|
action.perform();
|
||||||
promise.then.mostRecentCall.args[1]();
|
promise.then.mostRecentCall.args[1]();
|
||||||
expect(capabilities.editor.cancel).toHaveBeenCalled();
|
expect(capabilities.editor.finish).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user