[Fixed Position] Add tests for FixedController

Add additional test cases for controller for Fixed Position
view to meet code coverage after changes for WTD-879.
This commit is contained in:
Victor Woeltjen
2015-02-19 16:24:45 -08:00
parent 3cfcd027e0
commit 1015e97b3e
3 changed files with 112 additions and 21 deletions

View File

@ -24,6 +24,7 @@ define(
subscription,
cellStyles = [],
elementProxies = [],
elementProxiesById = {},
selection;
// Refresh cell styles (e.g. because grid extent changed)
@ -65,7 +66,7 @@ define(
function updateValue(telemetryObject) {
var id = telemetryObject && telemetryObject.getId();
if (id) {
elementProxies.forEach(function (element) {
(elementProxiesById[id] || []).forEach(function (element) {
element.name = telemetryObject.getModel().name;
element.value = telemetryFormatter.formatRangeValue(
subscription.getRangeValue(telemetryObject)
@ -120,6 +121,17 @@ define(
}
}
// Finally, rebuild lists of elements by id to
// facilitate faster update when new telemetry comes in.
elementProxiesById = {};
elementProxies.forEach(function (elementProxy) {
var id = elementProxy.id;
if (elementProxy.element.type === 'fixed.telemetry') {
elementProxiesById[id] = elementProxiesById[id] || [];
elementProxiesById[id].push(elementProxy);
}
});
// TODO: Ensure elements for all domain objects?
}
@ -224,11 +236,11 @@ define(
}
},
/**
* Get an array of elements in this panel, decorated for
* display.
* Get an array of elements in this panel; these are
* decorated proxies for both selection and display.
* @returns {Array} elements in this panel
*/
getDecoratedElements: function () {
getElements: function () {
return elementProxies;
},
/**