[Edit] CreateAction closes editor after save
This commit is contained in:
@@ -103,7 +103,6 @@ define(
|
|||||||
var domainObject = this.domainObject;
|
var domainObject = this.domainObject;
|
||||||
return this.transactionService.cancel().then(function () {
|
return this.transactionService.cancel().then(function () {
|
||||||
domainObject.getCapability("status").set("editing", false);
|
domainObject.getCapability("status").set("editing", false);
|
||||||
return domainObject;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -67,12 +67,17 @@ define(
|
|||||||
editAction,
|
editAction,
|
||||||
editorCapability;
|
editorCapability;
|
||||||
|
|
||||||
|
function closeEditor() {
|
||||||
|
return editorCapability.finish();
|
||||||
|
}
|
||||||
|
|
||||||
function onSave() {
|
function onSave() {
|
||||||
return editorCapability.save();
|
return editorCapability.save()
|
||||||
|
.then(closeEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCancel() {
|
function onCancel() {
|
||||||
return editorCapability.finish();
|
return closeEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
newModel.type = this.type.getKey();
|
newModel.type = this.type.getKey();
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("the perform function", function () {
|
describe("the perform function", function () {
|
||||||
|
var promise = jasmine.createSpyObj("promise", ["then"]);
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
capabilities.action.getActions.andReturn([mockEditAction]);
|
capabilities.action.getActions.andReturn([mockEditAction]);
|
||||||
});
|
});
|
||||||
@@ -160,15 +161,16 @@ define(
|
|||||||
" available", function () {
|
" available", function () {
|
||||||
capabilities.action.getActions.andReturn([]);
|
capabilities.action.getActions.andReturn([]);
|
||||||
capabilities.action.perform.andReturn(mockPromise(undefined));
|
capabilities.action.perform.andReturn(mockPromise(undefined));
|
||||||
|
capabilities.editor.save.andReturn(promise);
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(capabilities.action.perform).toHaveBeenCalledWith("save");
|
expect(capabilities.action.perform).toHaveBeenCalledWith("save");
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("uses to editor capability", function () {
|
describe("uses to editor capability", function () {
|
||||||
var promise = jasmine.createSpyObj("promise", ["then"]);
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
capabilities.action.getActions.andReturn([]);
|
capabilities.action.getActions.andReturn([]);
|
||||||
capabilities.action.perform.andReturn(promise);
|
capabilities.action.perform.andReturn(promise);
|
||||||
|
capabilities.editor.save.andReturn(promise);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("to save the edit if user saves dialog", function () {
|
it("to save the edit if user saves dialog", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user