Revert "Merge remote-tracking branch 'origin/open793'"
This reverts commitf49552779a, reversing changes made toe068173f3e.
This commit is contained in:
@@ -89,24 +89,20 @@ 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;
|
||||
|
||||
mockTelemetryHandle = jasmine.createSpyObj('telemetryHandle', [
|
||||
'request',
|
||||
'getMetadata',
|
||||
'unsubscribe',
|
||||
'getDatum',
|
||||
@@ -117,7 +113,6 @@ define(
|
||||
// used by mocks
|
||||
mockTelemetryHandle.getTelemetryObjects.andReturn([{}]);
|
||||
mockTelemetryHandle.promiseTelemetryObjects.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.request.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.getDatum.andReturn({});
|
||||
|
||||
mockTelemetryHandler = jasmine.createSpyObj('telemetryHandler', [
|
||||
@@ -128,8 +123,6 @@ 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 () {
|
||||
@@ -137,16 +130,14 @@ define(
|
||||
expect(mockTelemetryHandler.handle).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Function), true);
|
||||
});
|
||||
|
||||
describe('when receiving new telemetry', function () {
|
||||
describe('receives 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 () {
|
||||
|
||||
@@ -33,13 +33,7 @@ define(
|
||||
mockTelemetryHandler,
|
||||
mockTelemetryHandle,
|
||||
mockTelemetryFormatter,
|
||||
mockTelemetryCapability,
|
||||
mockDomainObject,
|
||||
mockChild,
|
||||
mockMutationCapability,
|
||||
mockCompositionCapability,
|
||||
childMutationCapability,
|
||||
capabilities = {},
|
||||
mockTable,
|
||||
mockConfiguration,
|
||||
watches,
|
||||
@@ -70,17 +64,6 @@ define(
|
||||
mockScope.$watchCollection.andCallFake(function (expression, callback){
|
||||
watches[expression] = callback;
|
||||
});
|
||||
mockTelemetryCapability = jasmine.createSpyObj('telemetryCapability',
|
||||
['getMetadata']
|
||||
);
|
||||
mockTelemetryCapability.getMetadata.andReturn({});
|
||||
capabilities.telemetry = mockTelemetryCapability;
|
||||
|
||||
mockCompositionCapability = jasmine.createSpyObj('compositionCapability',
|
||||
['invoke']
|
||||
);
|
||||
mockCompositionCapability.invoke.andReturn(promise([]));
|
||||
capabilities.composition = mockCompositionCapability;
|
||||
|
||||
mockConfiguration = {
|
||||
'range1': true,
|
||||
@@ -98,36 +81,13 @@ define(
|
||||
);
|
||||
mockTable.columns = [];
|
||||
mockTable.getColumnConfiguration.andReturn(mockConfiguration);
|
||||
mockMutationCapability = jasmine.createSpyObj('mutationCapability', [
|
||||
"listen"
|
||||
]);
|
||||
capabilities.mutation = mockMutationCapability;
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj('domainObject', [
|
||||
mockDomainObject= jasmine.createSpyObj('domainObject', [
|
||||
'getCapability',
|
||||
'hasCapability',
|
||||
'useCapability',
|
||||
'getModel'
|
||||
]);
|
||||
mockChild = jasmine.createSpyObj('domainObject', [
|
||||
'getCapability'
|
||||
]);
|
||||
childMutationCapability = jasmine.createSpyObj('childMutationCapability', [
|
||||
"listen"
|
||||
]);
|
||||
mockChild.getCapability.andReturn(childMutationCapability);
|
||||
|
||||
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.hasCapability.andCallFake(function (name){
|
||||
return typeof capabilities[name] !== 'undefined';
|
||||
});
|
||||
mockDomainObject.useCapability.andCallFake(function (capability){
|
||||
return capabilities[capability] && capabilities[capability].invoke && capabilities[capability].invoke();
|
||||
});
|
||||
mockDomainObject.getCapability.andCallFake(function (name){
|
||||
return capabilities[name];
|
||||
});
|
||||
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
|
||||
@@ -143,7 +103,6 @@ define(
|
||||
mockTelemetryHandle.promiseTelemetryObjects.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.request.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.getTelemetryObjects.andReturn([]);
|
||||
mockTelemetryHandle.getMetadata.andReturn(["a", "b", "c"]);
|
||||
|
||||
mockTelemetryHandler = jasmine.createSpyObj('telemetryHandler', [
|
||||
'handle'
|
||||
@@ -168,6 +127,7 @@ define(
|
||||
});
|
||||
|
||||
describe('the controller makes use of the table', function () {
|
||||
|
||||
it('to create column definitions from telemetry' +
|
||||
' metadata', function () {
|
||||
controller.setup();
|
||||
@@ -239,6 +199,14 @@ define(
|
||||
expect(controller.subscribe).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('triggers telemetry subscription update when domain' +
|
||||
' object composition changes', function () {
|
||||
controller.registerChangeListeners();
|
||||
expect(watches['domainObject.getModel().composition']).toBeDefined();
|
||||
watches['domainObject.getModel().composition']();
|
||||
expect(controller.subscribe).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('triggers telemetry subscription update when time' +
|
||||
' conductor bounds change', function () {
|
||||
controller.registerChangeListeners();
|
||||
@@ -246,21 +214,12 @@ define(
|
||||
watches['telemetry:display:bounds']();
|
||||
expect(controller.subscribe).toHaveBeenCalled();
|
||||
});
|
||||
it('Listens for changes to object model', function () {
|
||||
controller.registerChangeListeners();
|
||||
expect(mockMutationCapability.listen).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('Listens for changes to child model', function () {
|
||||
mockCompositionCapability.invoke.andReturn(promise([mockChild]));
|
||||
controller.registerChangeListeners();
|
||||
expect(childMutationCapability.listen).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('Recalculates columns when model changes occur', function () {
|
||||
controller.registerChangeListeners();
|
||||
expect(mockMutationCapability.listen).toHaveBeenCalled();
|
||||
mockMutationCapability.listen.mostRecentCall.args[0]();
|
||||
it('triggers refiltering of the columns when configuration' +
|
||||
' changes', function () {
|
||||
controller.setup();
|
||||
expect(watches['domainObject.getModel().configuration.table.columns']).toBeDefined();
|
||||
watches['domainObject.getModel().configuration.table.columns']();
|
||||
expect(controller.filterColumns).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user