Merge branch 'master' into open671
Conflicts: main.js platform/commonUI/edit/src/policies/EditableMovePolicy.js platform/commonUI/general/src/directives/MCTTree.js platform/commonUI/general/src/ui/ToggleView.js platform/core/src/actions/ActionCapability.js platform/core/test/models/CachingModelDecoratorSpec.js platform/core/test/services/InstantiateSpec.js platform/features/events/bundle.js platform/features/events/src/DomainColumn.js platform/features/events/src/EventListController.js platform/features/events/src/EventListPopulator.js platform/features/events/src/RangeColumn.js platform/features/events/src/directives/MCTDataTable.js platform/features/events/src/policies/MessagesViewPolicy.js platform/features/events/test/DomainColumnSpec.js platform/features/events/test/EventListControllerSpec.js platform/features/events/test/EventListPopulatorSpec.js platform/features/events/test/RangeColumnSpec.js platform/features/events/test/policies/MessagesViewPolicySpec.js platform/features/rtevents/bundle.js platform/features/rtevents/src/DomainColumn.js platform/features/rtevents/src/RTEventListController.js platform/features/rtevents/src/RangeColumn.js platform/features/rtevents/src/directives/MCTRTDataTable.js platform/features/rtevents/src/policies/RTMessagesViewPolicy.js platform/features/rtevents/test/DomainColumnSpec.js platform/features/rtevents/test/RTEventListControllerSpec.js platform/features/rtevents/test/RangeColumnSpec.js platform/features/rtevents/test/policies/RTMessagesViewPolicySpec.js platform/features/rtscrolling/bundle.js platform/features/rtscrolling/src/DomainColumn.js platform/features/rtscrolling/src/NameColumn.js platform/features/rtscrolling/src/RTScrollingListController.js platform/features/rtscrolling/src/RangeColumn.js platform/features/scrolling/src/DomainColumn.js platform/features/scrolling/src/RangeColumn.js platform/features/scrolling/src/ScrollingListController.js platform/features/scrolling/src/ScrollingListPopulator.js platform/features/scrolling/test/DomainColumnSpec.js platform/features/scrolling/test/RangeColumnSpec.js platform/features/scrolling/test/ScrollingListControllerSpec.js platform/features/scrolling/test/ScrollingListPopulatorSpec.js platform/features/table/src/directives/MCTTable.js platform/features/table/test/controllers/TelemetryTableControllerSpec.js platform/representation/src/gestures/DropGesture.js platform/telemetry/src/TelemetryFormatter.js test-main.js
This commit is contained in:
@@ -26,7 +26,7 @@ define(
|
||||
],
|
||||
function (TableController) {
|
||||
|
||||
describe('The Table Controller', function() {
|
||||
describe('The Table Controller', function () {
|
||||
var mockScope,
|
||||
mockTelemetryHandler,
|
||||
mockTelemetryHandle,
|
||||
@@ -45,7 +45,7 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
watches = {};
|
||||
mockScope = jasmine.createSpyObj('scope', [
|
||||
'$on',
|
||||
@@ -53,13 +53,13 @@ define(
|
||||
'$watchCollection'
|
||||
]);
|
||||
|
||||
mockScope.$on.andCallFake(function(expression, callback){
|
||||
mockScope.$on.andCallFake(function (expression, callback){
|
||||
watches[expression] = callback;
|
||||
});
|
||||
mockScope.$watch.andCallFake(function(expression, callback){
|
||||
mockScope.$watch.andCallFake(function (expression, callback){
|
||||
watches[expression] = callback;
|
||||
});
|
||||
mockScope.$watchCollection.andCallFake(function(expression, callback){
|
||||
mockScope.$watchCollection.andCallFake(function (expression, callback){
|
||||
watches[expression] = callback;
|
||||
});
|
||||
|
||||
@@ -92,11 +92,15 @@ define(
|
||||
mockTelemetryHandle = jasmine.createSpyObj('telemetryHandle', [
|
||||
'request',
|
||||
'promiseTelemetryObjects',
|
||||
'getTelemetryObjects',
|
||||
'getMetadata',
|
||||
'getSeries',
|
||||
'unsubscribe',
|
||||
'makeDatum'
|
||||
]);
|
||||
mockTelemetryHandle.promiseTelemetryObjects.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.request.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.getTelemetryObjects.andReturn([]);
|
||||
|
||||
mockTelemetryHandler = jasmine.createSpyObj('telemetryHandler', [
|
||||
'handle'
|
||||
@@ -108,60 +112,63 @@ define(
|
||||
controller.handle = mockTelemetryHandle;
|
||||
});
|
||||
|
||||
it('subscribes to telemetry handler for telemetry updates', function() {
|
||||
it('subscribes to telemetry handler for telemetry updates', function () {
|
||||
controller.subscribe();
|
||||
expect(mockTelemetryHandler.handle).toHaveBeenCalled();
|
||||
expect(mockTelemetryHandle.request).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('Unsubscribes from telemetry when scope is destroyed',function() {
|
||||
it('Unsubscribes from telemetry when scope is destroyed',function () {
|
||||
controller.handle = mockTelemetryHandle;
|
||||
watches.$destroy();
|
||||
expect(mockTelemetryHandle.unsubscribe).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('the controller makes use of the table', function() {
|
||||
describe('the controller makes use of the table', function () {
|
||||
|
||||
it('to create column definitions from telemetry' +
|
||||
' metadata', function() {
|
||||
' metadata', function () {
|
||||
controller.setup();
|
||||
expect(mockTable.buildColumns).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('to create column configuration, which is written to the' +
|
||||
' object model', function() {
|
||||
' object model', function () {
|
||||
controller.setup();
|
||||
expect(mockTable.getColumnConfiguration).toHaveBeenCalled();
|
||||
expect(mockTable.saveColumnConfiguration).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it('updates the rows on scope when historical telemetry is received', function(){
|
||||
it('updates the rows on scope when historical telemetry is received', function (){
|
||||
var mockSeries = {
|
||||
getPointCount: function() {
|
||||
getPointCount: function () {
|
||||
return 5;
|
||||
},
|
||||
getDomainValue: function() {
|
||||
getDomainValue: function () {
|
||||
return 'Domain Value';
|
||||
},
|
||||
getRangeValue: function() {
|
||||
getRangeValue: function () {
|
||||
return 'Range Value';
|
||||
}
|
||||
},
|
||||
mockRow = {'domain': 'Domain Value', 'range': 'Range' +
|
||||
' Value'};
|
||||
|
||||
mockTelemetryHandle.makeDatum.andCallFake(function(){
|
||||
mockTelemetryHandle.makeDatum.andCallFake(function (){
|
||||
return mockRow;
|
||||
});
|
||||
mockTable.getRowValues.andReturn(mockRow);
|
||||
mockTelemetryHandle.getTelemetryObjects.andReturn([mockDomainObject]);
|
||||
mockTelemetryHandle.getSeries.andReturn(mockSeries);
|
||||
|
||||
controller.addHistoricalData(mockDomainObject, mockSeries);
|
||||
|
||||
expect(controller.$scope.rows.length).toBe(5);
|
||||
expect(controller.$scope.rows[0]).toBe(mockRow);
|
||||
});
|
||||
|
||||
it('filters the visible columns based on configuration', function(){
|
||||
it('filters the visible columns based on configuration', function (){
|
||||
controller.filterColumns();
|
||||
expect(controller.$scope.headers.length).toBe(3);
|
||||
expect(controller.$scope.headers[2]).toEqual('domain1');
|
||||
@@ -172,14 +179,14 @@ define(
|
||||
expect(controller.$scope.headers[2]).toBeUndefined();
|
||||
});
|
||||
|
||||
describe('creates event listeners', function(){
|
||||
beforeEach(function() {
|
||||
describe('creates event listeners', function (){
|
||||
beforeEach(function () {
|
||||
spyOn(controller,'subscribe');
|
||||
spyOn(controller, 'filterColumns');
|
||||
});
|
||||
|
||||
it('triggers telemetry subscription update when domain' +
|
||||
' object changes', function() {
|
||||
' object changes', function () {
|
||||
controller.registerChangeListeners();
|
||||
//'watches' object is populated by fake scope watch and
|
||||
// watchCollection functions defined above
|
||||
@@ -189,7 +196,7 @@ define(
|
||||
});
|
||||
|
||||
it('triggers telemetry subscription update when domain' +
|
||||
' object composition changes', function() {
|
||||
' object composition changes', function () {
|
||||
controller.registerChangeListeners();
|
||||
expect(watches['domainObject.getModel().composition']).toBeDefined();
|
||||
watches['domainObject.getModel().composition']();
|
||||
@@ -197,7 +204,7 @@ define(
|
||||
});
|
||||
|
||||
it('triggers telemetry subscription update when time' +
|
||||
' conductor bounds change', function() {
|
||||
' conductor bounds change', function () {
|
||||
controller.registerChangeListeners();
|
||||
expect(watches['telemetry:display:bounds']).toBeDefined();
|
||||
watches['telemetry:display:bounds']();
|
||||
@@ -205,7 +212,7 @@ define(
|
||||
});
|
||||
|
||||
it('triggers refiltering of the columns when configuration' +
|
||||
' changes', function() {
|
||||
' changes', function () {
|
||||
controller.setup();
|
||||
expect(watches['domainObject.getModel().configuration.table.columns']).toBeDefined();
|
||||
watches['domainObject.getModel().configuration.table.columns']();
|
||||
|
||||
Reference in New Issue
Block a user