mirror of
https://github.com/nasa/openmct.git
synced 2025-06-10 03:11:39 +00:00
[Representation] Add test for scope clearing
Add test clearing to verify that scope gets cleared on view changes, WTD-1182.
This commit is contained in:
parent
9b6d8cf1ec
commit
cde173dbdc
@ -160,6 +160,25 @@ define(
|
|||||||
// Should have gotten a warning - that's an unknown key
|
// Should have gotten a warning - that's an unknown key
|
||||||
expect(mockLog.warn).toHaveBeenCalled();
|
expect(mockLog.warn).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("clears out obsolete peroperties from scope", function () {
|
||||||
|
mctRepresentation.link(mockScope, mockElement);
|
||||||
|
|
||||||
|
mockScope.key = "def";
|
||||||
|
mockScope.domainObject = mockDomainObject;
|
||||||
|
mockDomainObject.useCapability.andReturn("some value");
|
||||||
|
|
||||||
|
// Trigger the watch
|
||||||
|
mockScope.$watch.calls[0].args[1]();
|
||||||
|
expect(mockScope.testCapability).toBeDefined();
|
||||||
|
|
||||||
|
// Change the view
|
||||||
|
mockScope.key = "xyz";
|
||||||
|
|
||||||
|
// Trigger the watch again; should clear capability from scope
|
||||||
|
mockScope.$watch.calls[0].args[1]();
|
||||||
|
expect(mockScope.testCapability).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
x
Reference in New Issue
Block a user