mirror of
https://github.com/nasa/openmct.git
synced 2025-06-12 20:28:14 +00:00
[Plot] Fill in specs
Fill in specs for elements used by the PlotController in order to improve coverage of the plot bundle. WTD-533.
This commit is contained in:
@ -9,6 +9,46 @@ define(
|
||||
"use strict";
|
||||
|
||||
describe("A plot tick generator", function () {
|
||||
var mockPanZoomStack,
|
||||
mockFormatter,
|
||||
generator;
|
||||
|
||||
beforeEach(function () {
|
||||
mockPanZoomStack = jasmine.createSpyObj(
|
||||
"panZoomStack",
|
||||
[ "getPanZoom" ]
|
||||
);
|
||||
mockFormatter = jasmine.createSpyObj(
|
||||
"formatter",
|
||||
[ "formatDomainValue", "formatRangeValue" ]
|
||||
);
|
||||
|
||||
mockPanZoomStack.getPanZoom.andReturn({
|
||||
origin: [ 0, 0 ],
|
||||
dimensions: [ 100, 100 ]
|
||||
});
|
||||
|
||||
generator =
|
||||
new PlotTickGenerator(mockPanZoomStack, mockFormatter);
|
||||
});
|
||||
|
||||
it("provides tick marks for range", function () {
|
||||
expect(generator.generateRangeTicks(11).length).toEqual(11);
|
||||
|
||||
// Should have used range formatter
|
||||
expect(mockFormatter.formatRangeValue).toHaveBeenCalled();
|
||||
expect(mockFormatter.formatDomainValue).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
it("provides tick marks for domain", function () {
|
||||
expect(generator.generateDomainTicks(11).length).toEqual(11);
|
||||
|
||||
// Should have used domain formatter
|
||||
expect(mockFormatter.formatRangeValue).not.toHaveBeenCalled();
|
||||
expect(mockFormatter.formatDomainValue).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user