Merge remote-tracking branch 'github/master' into open116

Merge in latest from master into topic branch for
https://github.com/nasa/openmctweb/issues/116

Conflicts:
	platform/features/layout/test/FixedControllerSpec.js
	platform/features/plot/test/PlotControllerSpec.js
This commit is contained in:
Victor Woeltjen
2015-12-30 10:15:05 -08:00
41 changed files with 1779 additions and 774 deletions

View File

@@ -286,6 +286,7 @@ define(
expect(mockHandle.request.calls.length).toEqual(2);
});
it("maintains externally-provided domain axis bounds after data is received", function () {
mockSeries.getPointCount.andReturn(3);
mockSeries.getRangeValue.andReturn(42);
@@ -296,7 +297,7 @@ define(
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
fireEvent("telemetry:display:bounds", [
{},
{ start: 0, end: 10000 }
{start: 0, end: 10000}
]);
mockHandle.request.mostRecentCall.args[1](
mockDomainObject,
@@ -312,6 +313,33 @@ define(
controller.getSubPlots()[0].panZoomStack.getDimensions()[0]
).toEqual(10000);
});
it("provides classes for legends based on limit state", function () {
var mockTelemetryObjects = mockHandle.getTelemetryObjects();
mockHandle.getDatum.andReturn({});
mockTelemetryObjects.forEach(function (mockObject, i) {
var id = 'object-' + i,
mockLimitCapability =
jasmine.createSpyObj('limit-' + id, ['evaluate']);
mockObject.getId.andReturn(id);
mockObject.getCapability.andCallFake(function (key) {
return (key === 'limit') && mockLimitCapability;
});
mockLimitCapability.evaluate
.andReturn({ cssClass: 'alarm-' + id });
});
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
mockHandler.handle.mostRecentCall.args[1]();
mockTelemetryObjects.forEach(function (mockTelemetryObject) {
expect(controller.getLegendClass(mockTelemetryObject))
.toEqual('alarm-' + mockTelemetryObject.getId());
});
});
});
}
);

View File

@@ -0,0 +1,103 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
["../../src/elements/PlotLimitTracker"],
function (PlotLimitTracker) {
"use strict";
describe("A plot's limit tracker", function () {
var mockHandle,
testRange,
mockTelemetryObjects,
testData,
mockLimitCapabilities,
tracker;
beforeEach(function () {
testRange = "some-range";
testData = {};
mockHandle = jasmine.createSpyObj(
'handle',
['getTelemetryObjects', 'getDatum']
);
mockTelemetryObjects = ['a', 'b', 'c'].map(function (id, i) {
var mockTelemetryObject = jasmine.createSpyObj(
'object-' + id,
[ 'getId', 'getCapability', 'getModel' ]
),
mockLimitCapability = jasmine.createSpyObj(
'limit-' + id,
[ 'evaluate' ]
);
testData[id] = { id: id, value: i };
mockTelemetryObject.getId.andReturn(id);
mockTelemetryObject.getCapability.andCallFake(function (key) {
return key === 'limit' && mockLimitCapability;
});
mockLimitCapability.evaluate
.andReturn({ cssClass: 'alarm-' + id});
return mockTelemetryObject;
});
mockHandle.getTelemetryObjects.andReturn(mockTelemetryObjects);
mockHandle.getDatum.andCallFake(function (telemetryObject) {
return testData[telemetryObject.getId()];
});
tracker = new PlotLimitTracker(mockHandle, testRange);
});
it("initially provides no limit state", function () {
mockTelemetryObjects.forEach(function (mockTelemetryObject) {
expect(tracker.getLegendClass(mockTelemetryObject))
.toBeUndefined();
});
});
describe("when asked to update", function () {
beforeEach(function () {
tracker.update();
});
it("evaluates limits using the limit capability", function () {
mockTelemetryObjects.forEach(function (mockTelemetryObject) {
var id = mockTelemetryObject.getId(),
mockLimit =
mockTelemetryObject.getCapability('limit');
expect(mockLimit.evaluate)
.toHaveBeenCalledWith(testData[id], testRange);
});
});
it("exposes legend classes returned by the limit capability", function () {
mockTelemetryObjects.forEach(function (mockTelemetryObject) {
var id = mockTelemetryObject.getId();
expect(tracker.getLegendClass(mockTelemetryObject))
.toEqual('alarm-' + id);
});
});
});
});
}
);

View File

@@ -6,6 +6,7 @@
"SubPlot",
"SubPlotFactory",
"elements/PlotAxis",
"elements/PlotLimitTracker",
"elements/PlotLine",
"elements/PlotLineBuffer",
"elements/PlotPalette",