mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 22:28:13 +00:00
[Edit Mode] Fixed issue with save dialog not being displayed for new objects after mutation. Fixes 1080
This commit is contained in:
@ -32,7 +32,9 @@ define(
|
||||
mockQ,
|
||||
mockDomainObject,
|
||||
mockPolicyService,
|
||||
mockNavigatedObject,
|
||||
mockWindow,
|
||||
capabilities,
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
@ -44,6 +46,29 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
capabilities = {};
|
||||
|
||||
mockQ = { when: mockPromise };
|
||||
mockNavigatedObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[
|
||||
"getId",
|
||||
"getModel",
|
||||
"hasCapability",
|
||||
"getCapability"
|
||||
]
|
||||
);
|
||||
|
||||
capabilities.editor = jasmine.createSpyObj("editorCapability", [
|
||||
"isEditContextRoot",
|
||||
"cancel"
|
||||
]);
|
||||
|
||||
mockNavigatedObject.getCapability.andCallFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockNavigatedObject.hasCapability.andReturn(false);
|
||||
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
[
|
||||
@ -51,11 +76,14 @@ define(
|
||||
"getNavigation"
|
||||
]
|
||||
);
|
||||
mockNavigationService.getNavigation.andReturn({});
|
||||
mockQ = { when: mockPromise };
|
||||
mockNavigationService.getNavigation.andReturn(mockNavigatedObject);
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getModel", "getCapability"]
|
||||
[
|
||||
"getId",
|
||||
"getModel"
|
||||
]
|
||||
);
|
||||
|
||||
mockPolicyService = jasmine.createSpyObj("policyService",
|
||||
@ -112,6 +140,21 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
describe("in edit more", function () {
|
||||
beforeEach(function () {
|
||||
mockNavigatedObject.hasCapability.andCallFake(function (capability) {
|
||||
return capability === "editor";
|
||||
});
|
||||
capabilities.editor.isEditContextRoot.andReturn(true);
|
||||
});
|
||||
|
||||
it("cancels editing if in edit mode", function () {
|
||||
action.perform();
|
||||
expect(capabilities.editor.cancel)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("is only applicable when a domain object is in context", function () {
|
||||
expect(NavigateAction.appliesTo({})).toBeFalsy();
|
||||
expect(NavigateAction.appliesTo({
|
||||
|
Reference in New Issue
Block a user