[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -38,8 +38,8 @@ define(
|
||||
this.c2d = canvas.getContext('2d');
|
||||
this.width = canvas.width;
|
||||
this.height = canvas.height;
|
||||
this.dimensions = [ this.width, this.height ];
|
||||
this.origin = [ 0, 0 ];
|
||||
this.dimensions = [this.width, this.height];
|
||||
this.origin = [0, 0];
|
||||
|
||||
if (!this.c2d) {
|
||||
throw new Error("Canvas 2d API unavailable.");
|
||||
|
||||
@@ -57,7 +57,7 @@ define(
|
||||
Listen for changes to the domain object and update the object's
|
||||
children.
|
||||
*/
|
||||
this.mutationListener = this.domainObject.getCapability('mutation').listen(function(model) {
|
||||
this.mutationListener = this.domainObject.getCapability('mutation').listen(function (model) {
|
||||
if (self.hasCompositionChanged(self.composition, model.composition)) {
|
||||
self.updateChildren();
|
||||
}
|
||||
@@ -70,7 +70,7 @@ define(
|
||||
$scope.xAxisForm = this.plotOptionsForm.xAxisForm;
|
||||
$scope.yAxisForm = this.plotOptionsForm.yAxisForm;
|
||||
|
||||
$scope.$on("$destroy", function() {
|
||||
$scope.$on("$destroy", function () {
|
||||
//Clean up any listeners on destruction of controller
|
||||
self.mutationListener();
|
||||
});
|
||||
@@ -82,10 +82,10 @@ define(
|
||||
* Setup a number of watches for changes to form values. On
|
||||
* change, update the model configuration via mutation
|
||||
*/
|
||||
$scope.$watchCollection('configuration.plot.yAxis', function(newValue, oldValue){
|
||||
$scope.$watchCollection('configuration.plot.yAxis', function (newValue, oldValue) {
|
||||
self.updateConfiguration(newValue, oldValue);
|
||||
});
|
||||
$scope.$watchCollection('configuration.plot.xAxis', function(newValue, oldValue){
|
||||
$scope.$watchCollection('configuration.plot.xAxis', function (newValue, oldValue) {
|
||||
self.updateConfiguration(newValue, oldValue);
|
||||
});
|
||||
|
||||
@@ -98,8 +98,8 @@ define(
|
||||
* child objects)
|
||||
* @private
|
||||
*/
|
||||
PlotOptionsController.prototype.clearSeriesWatches = function() {
|
||||
this.watches.forEach(function(watch) {
|
||||
PlotOptionsController.prototype.clearSeriesWatches = function () {
|
||||
this.watches.forEach(function (watch) {
|
||||
watch();
|
||||
});
|
||||
this.watches = [];
|
||||
@@ -109,16 +109,16 @@ define(
|
||||
* Attach watches for each object in the plot's composition
|
||||
* @private
|
||||
*/
|
||||
PlotOptionsController.prototype.watchSeries = function() {
|
||||
PlotOptionsController.prototype.watchSeries = function () {
|
||||
var self = this;
|
||||
|
||||
this.clearSeriesWatches();
|
||||
|
||||
(self.$scope.children || []).forEach(function(child, index){
|
||||
(self.$scope.children || []).forEach(function (child, index) {
|
||||
self.watches.push(
|
||||
self.$scope.$watchCollection(
|
||||
'configuration.plot.series[' + index + ']',
|
||||
function(newValue, oldValue){
|
||||
function (newValue, oldValue) {
|
||||
self.updateConfiguration(newValue, oldValue);
|
||||
}
|
||||
)
|
||||
@@ -132,13 +132,13 @@ define(
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
PlotOptionsController.prototype.hasCompositionChanged = function(oldComposition, newComposition){
|
||||
PlotOptionsController.prototype.hasCompositionChanged = function (oldComposition, newComposition) {
|
||||
// Framed slightly strangely, but the boolean logic is
|
||||
// easier to follow for the unchanged case.
|
||||
var isUnchanged = oldComposition === newComposition ||
|
||||
(
|
||||
oldComposition.length === newComposition.length &&
|
||||
oldComposition.every( function (currentValue, index) {
|
||||
oldComposition.every(function (currentValue, index) {
|
||||
return newComposition[index] && currentValue === newComposition[index];
|
||||
})
|
||||
);
|
||||
@@ -163,12 +163,12 @@ define(
|
||||
* plot options model
|
||||
* @private
|
||||
*/
|
||||
PlotOptionsController.prototype.updateChildren = function() {
|
||||
PlotOptionsController.prototype.updateChildren = function () {
|
||||
var self = this;
|
||||
this.domainObject.useCapability('composition').then(function(children){
|
||||
this.domainObject.useCapability('composition').then(function (children) {
|
||||
self.$scope.children = children;
|
||||
self.composition = self.domainObject.getModel().composition;
|
||||
children.forEach(function(child, index){
|
||||
children.forEach(function (child, index) {
|
||||
self.configuration.plot.series[index] =
|
||||
self.configuration.plot.series[index] || {'id': child.getId()};
|
||||
});
|
||||
@@ -181,9 +181,9 @@ define(
|
||||
* object
|
||||
* @private
|
||||
*/
|
||||
PlotOptionsController.prototype.updateConfiguration = function() {
|
||||
PlotOptionsController.prototype.updateConfiguration = function () {
|
||||
var self = this;
|
||||
this.domainObject.useCapability('mutation', function(model){
|
||||
this.domainObject.useCapability('mutation', function (model) {
|
||||
model.configuration = model.configuration || {};
|
||||
model.configuration.plot = self.configuration.plot;
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
Defined below are the form structures for the plot options.
|
||||
*/
|
||||
this.xAxisForm = {
|
||||
'name':'x-axis',
|
||||
'name': 'x-axis',
|
||||
'sections': [{
|
||||
'name': 'x-axis',
|
||||
'rows': [
|
||||
@@ -46,30 +46,30 @@ define(
|
||||
'control': 'select',
|
||||
'key': 'key',
|
||||
'options': [
|
||||
{'name':'SCET', 'value': 'scet'},
|
||||
{'name':'SCLK', 'value': 'sclk'},
|
||||
{'name':'LST', 'value': 'lst'}
|
||||
{'name': 'SCET', 'value': 'scet'},
|
||||
{'name': 'SCLK', 'value': 'sclk'},
|
||||
{'name': 'LST', 'value': 'lst'}
|
||||
]
|
||||
}
|
||||
]
|
||||
}]};
|
||||
}]};
|
||||
|
||||
this.yAxisForm = {
|
||||
'name':'y-axis',
|
||||
'sections': [{
|
||||
// Will need to be repeated for each y-axis, with a
|
||||
// distinct name for each. Ideally the name of the axis
|
||||
// itself.
|
||||
'name': 'y-axis',
|
||||
'rows': [
|
||||
'sections': [{
|
||||
// Will need to be repeated for each y-axis, with a
|
||||
// distinct name for each. Ideally the name of the axis
|
||||
// itself.
|
||||
'name': 'y-axis',
|
||||
'rows': [
|
||||
{
|
||||
'name': 'Range',
|
||||
'control': 'select',
|
||||
'key': 'key',
|
||||
'options': [
|
||||
{'name':'EU', 'value': 'eu'},
|
||||
{'name':'DN', 'value': 'dn'},
|
||||
{'name':'Status', 'value': 'status'}
|
||||
{'name': 'EU', 'value': 'eu'},
|
||||
{'name': 'DN', 'value': 'dn'},
|
||||
{'name': 'Status', 'value': 'status'}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -95,7 +95,7 @@ define(
|
||||
}]
|
||||
};
|
||||
this.plotSeriesForm = {
|
||||
'name':'Series Options',
|
||||
'name': 'Series Options',
|
||||
'sections': [
|
||||
{
|
||||
rows: [
|
||||
@@ -106,7 +106,7 @@ define(
|
||||
}]
|
||||
},
|
||||
{
|
||||
'rows':[
|
||||
'rows': [
|
||||
{
|
||||
'name': 'Markers',
|
||||
'control': 'checkbox',
|
||||
@@ -116,7 +116,7 @@ define(
|
||||
]
|
||||
},
|
||||
{
|
||||
'rows':[
|
||||
'rows': [
|
||||
{
|
||||
'name': 'No Line',
|
||||
'control': 'radio',
|
||||
|
||||
@@ -67,7 +67,7 @@ define(
|
||||
* implies that there is no range data displayed either
|
||||
* @returns {boolean} true if domain data exists for the current pan/zoom level
|
||||
*/
|
||||
SubPlot.prototype.hasDomainData = function() {
|
||||
SubPlot.prototype.hasDomainData = function () {
|
||||
return this.panZoomStack &&
|
||||
this.panZoomStack.getDimensions()[0] > 0;
|
||||
};
|
||||
@@ -109,7 +109,7 @@ define(
|
||||
// associated with conversion to a 32-bit floating point
|
||||
// format (which is needed in the chart area itself, by WebGL.)
|
||||
SubPlot.prototype.toDisplayable = function (position) {
|
||||
return [ position[0] - this.domainOffset, position[1] ];
|
||||
return [position[0] - this.domainOffset, position[1]];
|
||||
};
|
||||
|
||||
// Update the current hover coordinates
|
||||
@@ -145,7 +145,7 @@ define(
|
||||
end: this.toDisplayable(
|
||||
this.mousePositionToDomainRange(this.mousePosition)
|
||||
),
|
||||
color: [1, 1, 1, 0.5 ]
|
||||
color: [1, 1, 1, 0.5]
|
||||
}] : undefined;
|
||||
};
|
||||
|
||||
@@ -189,7 +189,7 @@ define(
|
||||
this.panZoomStack
|
||||
);
|
||||
|
||||
delta = [ current[0] - start[0], current[1] - start[1] ];
|
||||
delta = [current[0] - start[0], current[1] - start[1]];
|
||||
nextOrigin = [
|
||||
this.panStartBounds.origin[0] - delta[0],
|
||||
this.panStartBounds.origin[1] - delta[1]
|
||||
|
||||
@@ -35,7 +35,7 @@ define(
|
||||
function PlotLineBuffer(domainOffset, initialSize, maxSize) {
|
||||
this.buffer = new Float32Array(initialSize * 2);
|
||||
this.rangeExtrema =
|
||||
[ Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY ];
|
||||
[Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY];
|
||||
this.length = 0;
|
||||
this.domainOffset = domainOffset;
|
||||
this.initialSize = initialSize;
|
||||
|
||||
@@ -30,36 +30,36 @@ define(
|
||||
// describe colors in several ways (as RGB 0-255, as
|
||||
// RGB 0.0-1.0, or as stylesheet-appropriate #-prefixed colors).
|
||||
var integerPalette = [
|
||||
[ 0x20, 0xB2, 0xAA ],
|
||||
[ 0x9A, 0xCD, 0x32 ],
|
||||
[ 0xFF, 0x8C, 0x00 ],
|
||||
[ 0xD2, 0xB4, 0x8C ],
|
||||
[ 0x40, 0xE0, 0xD0 ],
|
||||
[ 0x41, 0x69, 0xFF ],
|
||||
[ 0xFF, 0xD7, 0x00 ],
|
||||
[ 0x6A, 0x5A, 0xCD ],
|
||||
[ 0xEE, 0x82, 0xEE ],
|
||||
[ 0xCC, 0x99, 0x66 ],
|
||||
[ 0x99, 0xCC, 0xCC ],
|
||||
[ 0x66, 0xCC, 0x33 ],
|
||||
[ 0xFF, 0xCC, 0x00 ],
|
||||
[ 0xFF, 0x66, 0x33 ],
|
||||
[ 0xCC, 0x66, 0xFF ],
|
||||
[ 0xFF, 0x00, 0x66 ],
|
||||
[ 0xFF, 0xFF, 0x00 ],
|
||||
[ 0x80, 0x00, 0x80 ],
|
||||
[ 0x00, 0x86, 0x8B ],
|
||||
[ 0x00, 0x8A, 0x00 ],
|
||||
[ 0xFF, 0x00, 0x00 ],
|
||||
[ 0x00, 0x00, 0xFF ],
|
||||
[ 0xF5, 0xDE, 0xB3 ],
|
||||
[ 0xBC, 0x8F, 0x8F ],
|
||||
[ 0x46, 0x82, 0xB4 ],
|
||||
[ 0xFF, 0xAF, 0xAF ],
|
||||
[ 0x43, 0xCD, 0x80 ],
|
||||
[ 0xCD, 0xC1, 0xC5 ],
|
||||
[ 0xA0, 0x52, 0x2D ],
|
||||
[ 0x64, 0x95, 0xED ]
|
||||
[0x20, 0xB2, 0xAA],
|
||||
[0x9A, 0xCD, 0x32],
|
||||
[0xFF, 0x8C, 0x00],
|
||||
[0xD2, 0xB4, 0x8C],
|
||||
[0x40, 0xE0, 0xD0],
|
||||
[0x41, 0x69, 0xFF],
|
||||
[0xFF, 0xD7, 0x00],
|
||||
[0x6A, 0x5A, 0xCD],
|
||||
[0xEE, 0x82, 0xEE],
|
||||
[0xCC, 0x99, 0x66],
|
||||
[0x99, 0xCC, 0xCC],
|
||||
[0x66, 0xCC, 0x33],
|
||||
[0xFF, 0xCC, 0x00],
|
||||
[0xFF, 0x66, 0x33],
|
||||
[0xCC, 0x66, 0xFF],
|
||||
[0xFF, 0x00, 0x66],
|
||||
[0xFF, 0xFF, 0x00],
|
||||
[0x80, 0x00, 0x80],
|
||||
[0x00, 0x86, 0x8B],
|
||||
[0x00, 0x8A, 0x00],
|
||||
[0xFF, 0x00, 0x00],
|
||||
[0x00, 0x00, 0xFF],
|
||||
[0xF5, 0xDE, 0xB3],
|
||||
[0xBC, 0x8F, 0x8F],
|
||||
[0x46, 0x82, 0xB4],
|
||||
[0xFF, 0xAF, 0xAF],
|
||||
[0x43, 0xCD, 0x80],
|
||||
[0xCD, 0xC1, 0xC5],
|
||||
[0xA0, 0x52, 0x2D],
|
||||
[0x64, 0x95, 0xED]
|
||||
], stringPalette = integerPalette.map(function (arr) {
|
||||
// Convert to # notation for use in styles
|
||||
return '#' + arr.map(function (c) {
|
||||
|
||||
@@ -50,8 +50,8 @@ define(
|
||||
// For other stacks, do a push, but repeat
|
||||
// their current range axis bounds.
|
||||
stack.pushPanZoom(
|
||||
[ origin[0], stack.getOrigin()[1] ],
|
||||
[ dimensions[0], stack.getDimensions()[1] ]
|
||||
[origin[0], stack.getOrigin()[1]],
|
||||
[dimensions[0], stack.getDimensions()[1]]
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ define(
|
||||
// Note that range is reversed from the y-axis in pixel space
|
||||
//(positive range points up, positive pixel-y points down)
|
||||
this.position =
|
||||
[ x / width, (height - y) / height ].map(convert);
|
||||
[x / width, (height - y) / height].map(convert);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
define(
|
||||
function () {
|
||||
|
||||
function identity(x) { return x; }
|
||||
function identity(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* The PlotPreparer is responsible for handling data sets and
|
||||
|
||||
@@ -71,7 +71,7 @@ define(
|
||||
|
||||
// Used in the reduce step of updateExtrema
|
||||
function reduceExtrema(a, b) {
|
||||
return [ Math.min(a[0], b[0]), Math.max(a[1], b[1]) ];
|
||||
return [Math.min(a[0], b[0]), Math.max(a[1], b[1])];
|
||||
}
|
||||
|
||||
// Convert a domain/range extrema to plot dimensions
|
||||
@@ -173,9 +173,9 @@ define(
|
||||
}).reduce(reduceExtrema);
|
||||
|
||||
// Calculate best-fit dimensions
|
||||
this.dimensions = [ this.domainExtrema, this.rangeExtrema ]
|
||||
this.dimensions = [this.domainExtrema, this.rangeExtrema]
|
||||
.map(dimensionsOf);
|
||||
this.origin = [ this.domainExtrema, this.rangeExtrema ]
|
||||
this.origin = [this.domainExtrema, this.rangeExtrema]
|
||||
.map(originOf);
|
||||
|
||||
// Enforce some minimum visible area
|
||||
|
||||
@@ -89,7 +89,7 @@ define(
|
||||
*/
|
||||
function PlotModeOptions(telemetryObjects, subPlotFactory) {
|
||||
this.options = telemetryObjects.length > 1 ?
|
||||
[ OVERLAID, STACKED ] : [ OVERLAID ];
|
||||
[OVERLAID, STACKED] : [OVERLAID];
|
||||
this.mode = this.options[0]; // Initial selection (overlaid)
|
||||
this.telemetryObjects = telemetryObjects;
|
||||
this.subPlotFactory = subPlotFactory;
|
||||
|
||||
@@ -38,7 +38,7 @@ define(
|
||||
telemetryObjects,
|
||||
this.panZoomStack
|
||||
);
|
||||
this.subplots = [ this.subplot ];
|
||||
this.subplots = [this.subplot];
|
||||
}
|
||||
|
||||
PlotOverlayMode.prototype.plotTelemetry = function (updater) {
|
||||
|
||||
@@ -33,7 +33,7 @@ define(
|
||||
chart;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCanvas = jasmine.createSpyObj("canvas", [ "getContext" ]);
|
||||
mockCanvas = jasmine.createSpyObj("canvas", ["getContext"]);
|
||||
mock2d = jasmine.createSpyObj(
|
||||
"2d",
|
||||
[
|
||||
@@ -72,8 +72,8 @@ define(
|
||||
});
|
||||
|
||||
it("allows lines to be drawn", function () {
|
||||
var testBuffer = [ 0, 1, 3, 8 ],
|
||||
testColor = [ 0.25, 0.33, 0.66, 1.0 ],
|
||||
var testBuffer = [0, 1, 3, 8],
|
||||
testColor = [0.25, 0.33, 0.66, 1.0],
|
||||
testPoints = 2;
|
||||
chart.drawLine(testBuffer, testColor, testPoints);
|
||||
expect(mock2d.beginPath).toHaveBeenCalled();
|
||||
@@ -84,7 +84,7 @@ define(
|
||||
it("allows squares to be drawn", function () {
|
||||
var testMin = [0, 1],
|
||||
testMax = [10, 10],
|
||||
testColor = [ 0.25, 0.33, 0.66, 1.0 ];
|
||||
testColor = [0.25, 0.33, 0.66, 1.0];
|
||||
|
||||
chart.drawSquare(testMin, testMax, testColor);
|
||||
expect(mock2d.fillRect).toHaveBeenCalled();
|
||||
@@ -92,4 +92,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -33,7 +33,7 @@ define(
|
||||
glChart;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCanvas = jasmine.createSpyObj("canvas", [ "getContext" ]);
|
||||
mockCanvas = jasmine.createSpyObj("canvas", ["getContext"]);
|
||||
mockGL = jasmine.createSpyObj(
|
||||
"gl",
|
||||
[
|
||||
@@ -98,8 +98,8 @@ define(
|
||||
});
|
||||
|
||||
it("allows lines to be drawn", function () {
|
||||
var testBuffer = [ 0, 1, 3, 8 ],
|
||||
testColor = [ 0.25, 0.33, 0.66, 1.0 ],
|
||||
var testBuffer = [0, 1, 3, 8],
|
||||
testColor = [0.25, 0.33, 0.66, 1.0],
|
||||
testPoints = 2;
|
||||
glChart.drawLine(testBuffer, testColor, testPoints);
|
||||
expect(mockGL.bufferData).toHaveBeenCalledWith(
|
||||
@@ -116,7 +116,7 @@ define(
|
||||
it("allows squares to be drawn", function () {
|
||||
var testMin = [0, 1],
|
||||
testMax = [10, 10],
|
||||
testColor = [ 0.25, 0.33, 0.66, 1.0 ];
|
||||
testColor = [0.25, 0.33, 0.66, 1.0];
|
||||
|
||||
glChart.drawSquare(testMin, testMax, testColor);
|
||||
|
||||
@@ -140,4 +140,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -55,7 +55,7 @@ define(
|
||||
|
||||
// mct-chart uses GLChart, so it needs WebGL API
|
||||
mockCanvas =
|
||||
jasmine.createSpyObj("canvas", [ "getContext", "addEventListener" ]);
|
||||
jasmine.createSpyObj("canvas", ["getContext", "addEventListener"]);
|
||||
mockGL = jasmine.createSpyObj(
|
||||
"gl",
|
||||
[
|
||||
@@ -122,7 +122,7 @@ define(
|
||||
it("issues one draw call per line", function () {
|
||||
mctChart.link(mockScope, mockElement);
|
||||
mockScope.$watchCollection.mostRecentCall.args[1]({
|
||||
lines: [ {}, {}, {} ]
|
||||
lines: [{}, {}, {}]
|
||||
});
|
||||
expect(mockGL.drawArrays.calls.length).toEqual(3);
|
||||
});
|
||||
|
||||
@@ -63,15 +63,15 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "$watch", "$on", "$emit" ]
|
||||
["$watch", "$on", "$emit"]
|
||||
);
|
||||
mockFormatter = jasmine.createSpyObj(
|
||||
"formatter",
|
||||
[ "formatDomainValue", "formatRangeValue" ]
|
||||
["formatDomainValue", "formatRangeValue"]
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
mockHandler = jasmine.createSpyObj(
|
||||
"telemetrySubscriber",
|
||||
@@ -96,7 +96,9 @@ define(
|
||||
);
|
||||
|
||||
mockHandler.handle.andReturn(mockHandle);
|
||||
mockThrottle.andCallFake(function (fn) { return fn; });
|
||||
mockThrottle.andCallFake(function (fn) {
|
||||
return fn;
|
||||
});
|
||||
mockHandle.getTelemetryObjects.andReturn([mockDomainObject]);
|
||||
mockHandle.getMetadata.andReturn([{}]);
|
||||
mockHandle.getDomainValue.andReturn(123);
|
||||
|
||||
@@ -58,7 +58,7 @@ define(
|
||||
mockComposition = [
|
||||
mockChildOne
|
||||
];
|
||||
mockCompositionCapability.then.andCallFake(function (callback){
|
||||
mockCompositionCapability.then.andCallFake(function (callback) {
|
||||
callback(mockComposition);
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ define(
|
||||
'useCapability',
|
||||
'getCapability'
|
||||
]);
|
||||
mockDomainObject.useCapability.andCallFake(function(capability){
|
||||
mockDomainObject.useCapability.andCallFake(function (capability) {
|
||||
return mockUseCapabilities[capability]();
|
||||
});
|
||||
mockDomainObject.getCapability.andReturn(mockMutationCapability);
|
||||
|
||||
@@ -36,20 +36,20 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
mockPanZoomStack = jasmine.createSpyObj(
|
||||
"panZoomStack",
|
||||
[ "getPanZoom" ]
|
||||
["getPanZoom"]
|
||||
);
|
||||
mockFormatter = jasmine.createSpyObj(
|
||||
"formatter",
|
||||
[ "formatDomainValue", "formatRangeValue" ]
|
||||
["formatDomainValue", "formatRangeValue"]
|
||||
);
|
||||
|
||||
mockPanZoomStack.getPanZoom.andReturn({
|
||||
origin: [ 0, 0 ],
|
||||
dimensions: [ 100, 100 ]
|
||||
origin: [0, 0],
|
||||
dimensions: [100, 100]
|
||||
});
|
||||
|
||||
factory = new SubPlotFactory(mockFormatter);
|
||||
@@ -63,4 +63,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
mockPanZoomStack = jasmine.createSpyObj(
|
||||
"panZoomStack",
|
||||
@@ -57,16 +57,16 @@ define(
|
||||
);
|
||||
mockFormatter = jasmine.createSpyObj(
|
||||
"formatter",
|
||||
[ "formatDomainValue", "formatRangeValue" ]
|
||||
["formatDomainValue", "formatRangeValue"]
|
||||
);
|
||||
mockElement = jasmine.createSpyObj(
|
||||
"element",
|
||||
[ "getBoundingClientRect" ]
|
||||
["getBoundingClientRect"]
|
||||
);
|
||||
|
||||
testOrigin = [ 5, 10 ];
|
||||
testDimensions = [ 3000, 1000 ];
|
||||
testDomainObjects = [ mockDomainObject, mockDomainObject ];
|
||||
testOrigin = [5, 10];
|
||||
testDimensions = [3000, 1000];
|
||||
testDomainObjects = [mockDomainObject, mockDomainObject];
|
||||
|
||||
mockPanZoomStack.getOrigin.andReturn(testOrigin);
|
||||
mockPanZoomStack.getDimensions.andReturn(testDimensions);
|
||||
@@ -163,7 +163,7 @@ define(
|
||||
mockPanZoomStack.getDimensions.andReturn([0,0]);
|
||||
expect(subplot.hasDomainData()).toEqual(false);
|
||||
});
|
||||
|
||||
|
||||
it("disallows marquee zoom when start and end Marquee is at the same position", function () {
|
||||
expect(mockPanZoomStack.pushPanZoom).not.toHaveBeenCalled();
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ define(
|
||||
});
|
||||
|
||||
it("reflects changes to applicable metadata", function () {
|
||||
axis.updateMetadata([ testMetadatas[1] ]);
|
||||
axis.updateMetadata([testMetadatas[1]]);
|
||||
expect(axis.options).toEqual([
|
||||
{ key: "t0", name: "T0" },
|
||||
{ key: "t2", name: "T2" }
|
||||
|
||||
@@ -41,11 +41,11 @@ define(
|
||||
mockTelemetryObjects = ['a', 'b', 'c'].map(function (id, i) {
|
||||
var mockTelemetryObject = jasmine.createSpyObj(
|
||||
'object-' + id,
|
||||
[ 'getId', 'getCapability', 'getModel' ]
|
||||
['getId', 'getCapability', 'getModel']
|
||||
),
|
||||
mockLimitCapability = jasmine.createSpyObj(
|
||||
'limit-' + id,
|
||||
[ 'evaluate' ]
|
||||
['evaluate']
|
||||
);
|
||||
testData[id] = { id: id, value: i };
|
||||
mockTelemetryObject.getId.andReturn(id);
|
||||
|
||||
@@ -38,8 +38,8 @@ define(
|
||||
buffer;
|
||||
|
||||
beforeEach(function () {
|
||||
testDomainValues = [ 1, 3, 7, 9, 14, 15 ];
|
||||
testRangeValues = [ 8, 0, 3, 9, 8, 11 ];
|
||||
testDomainValues = [1, 3, 7, 9, 14, 15];
|
||||
testRangeValues = [8, 0, 3, 9, 8, 11];
|
||||
mockSeries = jasmine.createSpyObj(
|
||||
"series",
|
||||
['getPointCount', 'getDomainValue', 'getRangeValue']
|
||||
@@ -70,7 +70,7 @@ define(
|
||||
// that domain offset was adjusted for.
|
||||
expect(
|
||||
Array.prototype.slice.call(buffer.getBuffer()).slice(0, 12)
|
||||
).toEqual([ -41, 8, -39, 0, -35, 3, -33, 9, -28, 8, -27, 11]);
|
||||
).toEqual([-41, 8, -39, 0, -35, 3, -33, 9, -28, 8, -27, 11]);
|
||||
expect(buffer.getLength()).toEqual(6);
|
||||
});
|
||||
|
||||
@@ -84,8 +84,8 @@ define(
|
||||
});
|
||||
|
||||
it("allows insertion in the middle", function () {
|
||||
var head = [ -41, 8, -39, 0, -35, 3 ],
|
||||
tail = [ -33, 9, -28, 8, -27, 11];
|
||||
var head = [-41, 8, -39, 0, -35, 3],
|
||||
tail = [-33, 9, -28, 8, -27, 11];
|
||||
buffer.insert(mockSeries, 3);
|
||||
expect(
|
||||
Array.prototype.slice.call(buffer.getBuffer()).slice(0, 24)
|
||||
@@ -98,7 +98,7 @@ define(
|
||||
expect(buffer.getLength()).toEqual(4);
|
||||
expect(
|
||||
Array.prototype.slice.call(buffer.getBuffer()).slice(0, 8)
|
||||
).toEqual([ -35, 3, -33, 9, -28, 8, -27, 11]);
|
||||
).toEqual([-35, 3, -33, 9, -28, 8, -27, 11]);
|
||||
});
|
||||
|
||||
it("expands buffer when needed to accommodate more data", function () {
|
||||
|
||||
@@ -101,7 +101,7 @@ define(
|
||||
});
|
||||
|
||||
it("allows series insertion", function () {
|
||||
testSeries = [ [ 50, 42 ], [ 100, 200 ], [ 150, 12321 ] ];
|
||||
testSeries = [[50, 42], [100, 200], [150, 12321]];
|
||||
line.addSeries(mockSeries);
|
||||
// Should have managed insertion index choices to get to...
|
||||
expect(testDomainBuffer).toEqual([50, 100, 150]);
|
||||
@@ -109,7 +109,7 @@ define(
|
||||
});
|
||||
|
||||
it("splits series insertion when necessary", function () {
|
||||
testSeries = [ [ 50, 42 ], [ 100, 200 ], [ 150, 12321 ] ];
|
||||
testSeries = [[50, 42], [100, 200], [150, 12321]];
|
||||
line.addPoint(75, 1);
|
||||
line.addSeries(mockSeries);
|
||||
// Should have managed insertion index choices to get to...
|
||||
@@ -130,4 +130,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -120,4 +120,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -49,7 +49,7 @@ define(
|
||||
|
||||
it("synchronizes pan-zoom stack depth", function () {
|
||||
expect(group.getDepth()).toEqual(1);
|
||||
group.getPanZoomStack(1).pushPanZoom([ 10, 20 ], [ 30, 40 ]);
|
||||
group.getPanZoomStack(1).pushPanZoom([10, 20], [30, 40]);
|
||||
stacks.forEach(function (stack) {
|
||||
expect(stack.getDepth()).toEqual(2);
|
||||
});
|
||||
@@ -58,11 +58,11 @@ define(
|
||||
it("synchronizes domain but not range", function () {
|
||||
// Set up different initial states
|
||||
stacks.forEach(function (stack, i) {
|
||||
stack.pushPanZoom([ i, i ], [ i, i ]);
|
||||
stack.pushPanZoom([i, i], [i, i]);
|
||||
});
|
||||
|
||||
// Push a new pan-zoom state onto one of the stacks
|
||||
group.getPanZoomStack(1).pushPanZoom([ 99, 99 ], [ 42, 42 ]);
|
||||
group.getPanZoomStack(1).pushPanZoom([99, 99], [42, 42]);
|
||||
|
||||
// Should changed domain values for all stacks, but
|
||||
// only changed range values for stack 1
|
||||
@@ -85,7 +85,7 @@ define(
|
||||
it("clears pan-zoom on request", function () {
|
||||
// Set up different initial states
|
||||
stacks.forEach(function (stack, i) {
|
||||
stack.pushPanZoom([ i, i ], [ i, i ]);
|
||||
stack.pushPanZoom([i, i], [i, i]);
|
||||
});
|
||||
|
||||
// Verify that we have a greater depth
|
||||
@@ -104,7 +104,7 @@ define(
|
||||
it("pops pan-zoom on request", function () {
|
||||
// Set up different initial states
|
||||
stacks.forEach(function (stack, i) {
|
||||
stack.pushPanZoom([ i, i ], [ i, i ]);
|
||||
stack.pushPanZoom([i, i], [i, i]);
|
||||
});
|
||||
|
||||
// Verify that we have a greater depth
|
||||
@@ -123,4 +123,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -46,10 +46,10 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
initialOrigin = [ 4, 2 ];
|
||||
initialDimensions = [ 600, 400 ];
|
||||
otherOrigins = [ [8, 6], [12, 9] ];
|
||||
otherDimensions = [ [400, 300], [200, 300] ];
|
||||
initialOrigin = [4, 2];
|
||||
initialDimensions = [600, 400];
|
||||
otherOrigins = [[8, 6], [12, 9]];
|
||||
otherDimensions = [[400, 300], [200, 300]];
|
||||
panZoomStack =
|
||||
new PlotPanZoomStack(initialOrigin, initialDimensions);
|
||||
});
|
||||
@@ -96,4 +96,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -29,13 +29,13 @@ define(
|
||||
|
||||
describe("A plot position", function () {
|
||||
var mockPanZoom,
|
||||
testOrigin = [ 10, 20 ],
|
||||
testDimensions = [ 800, 10 ];
|
||||
testOrigin = [10, 20],
|
||||
testDimensions = [800, 10];
|
||||
|
||||
beforeEach(function () {
|
||||
mockPanZoom = jasmine.createSpyObj(
|
||||
"panZoomStack",
|
||||
[ "getPanZoom" ]
|
||||
["getPanZoom"]
|
||||
);
|
||||
mockPanZoom.getPanZoom.andReturn({
|
||||
origin: testOrigin,
|
||||
@@ -64,4 +64,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ define(
|
||||
function makeMockData(scale) {
|
||||
var mockData = jasmine.createSpyObj(
|
||||
"data" + scale,
|
||||
[ "getPointCount", "getDomainValue", "getRangeValue" ]
|
||||
["getPointCount", "getDomainValue", "getRangeValue"]
|
||||
);
|
||||
mockData.getPointCount.andReturn(1000);
|
||||
mockData.getDomainValue.andCallFake(function (i) {
|
||||
@@ -90,4 +90,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -31,11 +31,11 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
testSeries = [
|
||||
[ 0, 42 ],
|
||||
[ 10, 1 ],
|
||||
[ 20, 4 ],
|
||||
[ 30, 9 ],
|
||||
[ 40, 3 ]
|
||||
[0, 42],
|
||||
[10, 1],
|
||||
[20, 4],
|
||||
[30, 9],
|
||||
[40, 3]
|
||||
];
|
||||
|
||||
mockSeries = jasmine.createSpyObj(
|
||||
@@ -90,4 +90,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -35,16 +35,16 @@ define(
|
||||
beforeEach(function () {
|
||||
mockPanZoomStack = jasmine.createSpyObj(
|
||||
"panZoomStack",
|
||||
[ "getPanZoom" ]
|
||||
["getPanZoom"]
|
||||
);
|
||||
mockFormatter = jasmine.createSpyObj(
|
||||
"formatter",
|
||||
[ "formatDomainValue", "formatRangeValue" ]
|
||||
["formatDomainValue", "formatRangeValue"]
|
||||
);
|
||||
|
||||
mockPanZoomStack.getPanZoom.andReturn({
|
||||
origin: [ 0, 0 ],
|
||||
dimensions: [ 100, 100 ]
|
||||
origin: [0, 0],
|
||||
dimensions: [100, 100]
|
||||
});
|
||||
|
||||
generator =
|
||||
@@ -70,4 +70,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -39,19 +39,19 @@ define(
|
||||
function makeMockDomainObject(id) {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
"object-" + id,
|
||||
[ "getId", "getCapability", "getModel" ]
|
||||
["getId", "getCapability", "getModel"]
|
||||
);
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
return mockDomainObject;
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
var ids = [ 'a', 'b', 'c' ],
|
||||
var ids = ['a', 'b', 'c'],
|
||||
mockObjects = ids.map(makeMockDomainObject);
|
||||
|
||||
mockSubscription = jasmine.createSpyObj(
|
||||
"subscription",
|
||||
[ "getDomainValue", "getRangeValue", "getTelemetryObjects" ]
|
||||
["getDomainValue", "getRangeValue", "getTelemetryObjects"]
|
||||
);
|
||||
mockSeries = jasmine.createSpyObj(
|
||||
'series',
|
||||
|
||||
@@ -34,11 +34,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
mockSubPlotFactory = jasmine.createSpyObj(
|
||||
"subPlotFactory",
|
||||
[ "createSubPlot" ]
|
||||
["createSubPlot"]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -84,4 +84,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -58,11 +58,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
mockSubPlotFactory = jasmine.createSpyObj(
|
||||
"subPlotFactory",
|
||||
[ "createSubPlot" ]
|
||||
["createSubPlot"]
|
||||
);
|
||||
// Prepared telemetry data
|
||||
mockPrepared = jasmine.createSpyObj(
|
||||
@@ -181,4 +181,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -58,16 +58,16 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
mockSubPlotFactory = jasmine.createSpyObj(
|
||||
"subPlotFactory",
|
||||
[ "createSubPlot" ]
|
||||
["createSubPlot"]
|
||||
);
|
||||
// Prepared telemetry data
|
||||
mockPrepared = jasmine.createSpyObj(
|
||||
"prepared",
|
||||
[ "getDomainOffset", "getOrigin", "getDimensions", "getLineBuffers" ]
|
||||
["getDomainOffset", "getOrigin", "getDimensions", "getLineBuffers"]
|
||||
);
|
||||
|
||||
mockSubPlotFactory.createSubPlot.andCallFake(createMockSubPlot);
|
||||
@@ -176,4 +176,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -51,23 +51,23 @@ define(
|
||||
});
|
||||
|
||||
it("allows the imagery view for domain objects with numeric telemetry", function () {
|
||||
testMetadata.ranges = [ { key: "foo", format: "number" } ];
|
||||
testMetadata.ranges = [{ key: "foo", format: "number" }];
|
||||
expect(policy.allow(testView, mockDomainObject)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("allows the imagery view for domain objects with unspecified telemetry", function () {
|
||||
testMetadata.ranges = [ { key: "foo" } ];
|
||||
testMetadata.ranges = [{ key: "foo" }];
|
||||
expect(policy.allow(testView, mockDomainObject)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("disallows the imagery view for domain objects without image telemetry", function () {
|
||||
testMetadata.ranges = [ { key: "foo", format: "somethingElse" } ];
|
||||
testMetadata.ranges = [{ key: "foo", format: "somethingElse" }];
|
||||
expect(policy.allow(testView, mockDomainObject)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("allows other views", function () {
|
||||
testView.key = "somethingElse";
|
||||
testMetadata.ranges = [ { key: "foo", format: "somethingElse" } ];
|
||||
testMetadata.ranges = [{ key: "foo", format: "somethingElse" }];
|
||||
expect(policy.allow(testView, mockDomainObject)).toBeTruthy();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user