mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 15:18:12 +00:00
Added mutation listener
This commit is contained in:
@ -89,16 +89,19 @@ define(
|
||||
|
||||
mockDomainObject= jasmine.createSpyObj('domainObject', [
|
||||
'getCapability',
|
||||
'hasCapability',
|
||||
'useCapability',
|
||||
'getModel'
|
||||
]);
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(
|
||||
{
|
||||
getMetadata: function (){
|
||||
return {ranges: [{format: 'string'}]};
|
||||
}
|
||||
});
|
||||
mockDomainObject.useCapability.andReturn(promise([]));
|
||||
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
|
||||
@ -125,6 +128,8 @@ define(
|
||||
controller = new TableController(mockScope, mockTelemetryHandler, mockTelemetryFormatter);
|
||||
controller.table = mockTable;
|
||||
controller.handle = mockTelemetryHandle;
|
||||
spyOn(controller, 'updateRealtime');
|
||||
controller.updateRealtime.andCallThrough();
|
||||
});
|
||||
|
||||
it('registers for streaming telemetry', function () {
|
||||
@ -132,14 +137,16 @@ define(
|
||||
expect(mockTelemetryHandler.handle).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Function), true);
|
||||
});
|
||||
|
||||
describe('receives new telemetry', function () {
|
||||
describe('when receiving new telemetry', function () {
|
||||
beforeEach(function() {
|
||||
controller.subscribe();
|
||||
mockScope.rows = [];
|
||||
mockTable.columns = ['a', 'b'];
|
||||
});
|
||||
|
||||
it('updates table with new streaming telemetry', function () {
|
||||
mockTelemetryHandler.handle.mostRecentCall.args[1]();
|
||||
expect(controller.updateRealtime).toHaveBeenCalled();
|
||||
expect(mockScope.$broadcast).toHaveBeenCalledWith('add:row', 0);
|
||||
});
|
||||
it('observes the row limit', function () {
|
||||
|
Reference in New Issue
Block a user