[Actions] Update to use isPersistable API Method (#4432)

* added persistance check to edit properties action
* adding persistence check in browse bar as well as reverting passing in openmct in bundle and now passing it in through appliesTo method
* adding other actions that need to be persistable
* adding persistance check to set primary location action

Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
Jamie V
2021-12-06 12:42:22 -08:00
committed by GitHub
parent 420edb75f8
commit 7b53cad2c5
10 changed files with 83 additions and 31 deletions

View File

@@ -42,7 +42,6 @@ define(
newObjects;
beforeEach(function () {
uniqueId = 0;
newObjects = [];
openmct = {
@@ -50,9 +49,11 @@ define(
objects: {
makeKeyString: function (identifier) {
return identifier.key;
}
},
isPersistable: jasmine.createSpy('isPersistable')
}
};
openmct.objects.isPersistable.and.returnValue(true);
mockInstantiate = jasmine.createSpy('instantiate').and.callFake(
function (model, id) {
var config = {
@@ -121,9 +122,22 @@ define(
var noCompDomainObject = domainObjectFactory();
context.domainObject = compDomainObject;
expect(ImportAsJSONAction.appliesTo(context)).toBe(true);
expect(ImportAsJSONAction.appliesTo(context, undefined, openmct)).toBe(true);
context.domainObject = noCompDomainObject;
expect(ImportAsJSONAction.appliesTo(context)).toBe(false);
expect(ImportAsJSONAction.appliesTo(context, undefined, openmct)).toBe(false);
});
it("checks object persistability", function () {
var compDomainObject = domainObjectFactory({
name: 'compObject',
model: { name: 'compObject'},
capabilities: {"composition": compositionCapability}
});
context.domainObject = compDomainObject;
ImportAsJSONAction.appliesTo(context, undefined, openmct);
expect(openmct.objects.isPersistable).toHaveBeenCalled();
});
it("displays error dialog on invalid file choice", function () {