mirror of
https://github.com/nasa/openmct.git
synced 2025-06-12 20:28:14 +00:00
[Edit] Don't wrap non-editable objects
In Edit mode, don't bother wrapping domain objects which should not be edited even in principle. Avoids insulating these objects from updates which occur asynchronously, which in turn avoids WTD-1291.
This commit is contained in:
@ -32,6 +32,7 @@ define(
|
||||
completionCapability,
|
||||
object,
|
||||
mockQ,
|
||||
mockType,
|
||||
cache;
|
||||
|
||||
|
||||
@ -40,10 +41,13 @@ define(
|
||||
return {
|
||||
getId: function () { return id; },
|
||||
getModel: function () { return {}; },
|
||||
getCapability: function (name) {
|
||||
return completionCapability;
|
||||
getCapability: function (key) {
|
||||
return {
|
||||
editor: completionCapability,
|
||||
type: mockType
|
||||
}[key];
|
||||
},
|
||||
hasCapability: function (name) {
|
||||
hasCapability: function (key) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -62,6 +66,8 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
|
||||
mockType = jasmine.createSpyObj('type', ['hasFeature']);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
captured = {};
|
||||
completionCapability = {
|
||||
save: function () {
|
||||
@ -152,6 +158,17 @@ define(
|
||||
.toBe(wrappedObject);
|
||||
});
|
||||
|
||||
it("does not wrap non-editable objects", function () {
|
||||
var domainObject = new TestObject('test-id');
|
||||
|
||||
mockType.hasFeature.andCallFake(function (key) {
|
||||
return key !== 'creation';
|
||||
});
|
||||
|
||||
expect(cache.getEditableObject(domainObject))
|
||||
.toBe(domainObject);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user