mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 11:17:04 +00:00
Fixed bug in copying #428
This commit is contained in:
parent
f55168d1ac
commit
6302e45c10
@ -117,7 +117,7 @@ define(
|
||||
if (Array.isArray(obj)) {
|
||||
obj.forEach(function (value, index) {
|
||||
obj[index] = idMap[value] || value;
|
||||
this.rewriteIdentifiers(obj[index]);
|
||||
this.rewriteIdentifiers(obj[index], idMap);
|
||||
}, this);
|
||||
} else if (obj && typeof obj === 'object') {
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
|
@ -105,7 +105,8 @@ define(
|
||||
testModel = {
|
||||
composition: [ ID_A, ID_B ],
|
||||
someObj: {},
|
||||
someArr: [ ID_A, ID_B ]
|
||||
someArr: [ ID_A, ID_B ],
|
||||
objArr: [{"id": ID_A}, {"id": ID_B}]
|
||||
};
|
||||
testModel.someObj[ID_A] = "some value";
|
||||
testModel.someObj.someProperty = ID_B;
|
||||
@ -242,6 +243,23 @@ define(
|
||||
expect(domainObjectBClone.model.someObj.someProperty).toBe(childD_ID);
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* This a bug found in testathon when testing issue #428
|
||||
*/
|
||||
it(" and correctly updates child identifiers in object" +
|
||||
" arrays within models ", function () {
|
||||
var childA_ID = task.clones[0].getId(),
|
||||
childB_ID = task.clones[1].getId(),
|
||||
childC_ID = task.clones[3].getId(),
|
||||
childD_ID = task.clones[4].getId();
|
||||
|
||||
expect(domainObjectClone.model.objArr[0].id).not.toBe(ID_A);
|
||||
expect(domainObjectClone.model.objArr[0].id).toBe(childA_ID);
|
||||
expect(domainObjectClone.model.objArr[1].id).not.toBe(ID_B);
|
||||
expect(domainObjectClone.model.objArr[1].id).toBe(childB_ID);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user