mirror of
https://github.com/nasa/openmct.git
synced 2025-01-31 16:36:13 +00:00
[Plot] Specs for PlotModeOptions
Add specs for PlotModeOptions, introduced to allow switching between Stacked and Overlaid mode for WTD-625.
This commit is contained in:
parent
7ea63fce8c
commit
112d94e189
@ -9,6 +9,55 @@ define(
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Plot mode options", function () {
|
describe("Plot mode options", function () {
|
||||||
|
var mockDomainObject;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
mockDomainObject = jasmine.createSpyObj(
|
||||||
|
"domainObject",
|
||||||
|
[ "getId", "getModel", "getCapability" ]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("offers only one option when one object is present", function () {
|
||||||
|
expect(
|
||||||
|
new PlotModeOptions([mockDomainObject])
|
||||||
|
.getModeOptions().length
|
||||||
|
).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("offers two options when multiple objects are present", function () {
|
||||||
|
var objects = [
|
||||||
|
mockDomainObject,
|
||||||
|
mockDomainObject,
|
||||||
|
mockDomainObject,
|
||||||
|
mockDomainObject
|
||||||
|
];
|
||||||
|
expect(
|
||||||
|
new PlotModeOptions(objects)
|
||||||
|
.getModeOptions().length
|
||||||
|
).toEqual(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("allows modes to be changed", function () {
|
||||||
|
var plotModeOptions = new PlotModeOptions([
|
||||||
|
mockDomainObject,
|
||||||
|
mockDomainObject,
|
||||||
|
mockDomainObject,
|
||||||
|
mockDomainObject
|
||||||
|
]),
|
||||||
|
initialHandler = plotModeOptions.getModeHandler();
|
||||||
|
|
||||||
|
// Change the mode
|
||||||
|
plotModeOptions.getModeOptions().forEach(function (option) {
|
||||||
|
if (option !== plotModeOptions.getMode()) {
|
||||||
|
plotModeOptions.setMode(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mode should be different now
|
||||||
|
expect(plotModeOptions.getModeHandler())
|
||||||
|
.not.toBe(initialHandler);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
x
Reference in New Issue
Block a user