mirror of
https://github.com/nasa/openmct.git
synced 2025-01-06 13:18:44 +00:00
91754f76ad
Update specs for Fixed Position view to ensure code coverage after changes for resize/reposition behavior, WTD-882.
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
/*global define,describe,it,expect,beforeEach,jasmine*/
|
|
|
|
define(
|
|
['../../src/elements/ElementProxy'],
|
|
function (ElementProxy) {
|
|
"use strict";
|
|
|
|
describe("A fixed position element proxy", function () {
|
|
var testElement,
|
|
testElements,
|
|
proxy;
|
|
|
|
beforeEach(function () {
|
|
testElement = {
|
|
x: 1,
|
|
y: 2,
|
|
stroke: '#717171',
|
|
width: 42,
|
|
height: 24
|
|
};
|
|
testElements = [ {}, {}, testElement, {} ];
|
|
proxy = new ElementProxy(
|
|
testElement,
|
|
testElements.indexOf(testElement),
|
|
testElements
|
|
);
|
|
});
|
|
|
|
it("exposes element properties", function () {
|
|
Object.keys(testElement).forEach(function (k) {
|
|
expect(proxy[k]()).toEqual(testElement[k]);
|
|
});
|
|
});
|
|
|
|
it("allows elements to be removed", function () {
|
|
proxy.remove();
|
|
expect(testElements).toEqual([{}, {}, {}]);
|
|
});
|
|
|
|
it("allows order to be changed", function () {
|
|
proxy.order("down");
|
|
expect(testElements).toEqual([{}, testElement, {}, {}]);
|
|
proxy.order("up");
|
|
expect(testElements).toEqual([{}, {}, testElement, {}]);
|
|
proxy.order("bottom");
|
|
expect(testElements).toEqual([testElement, {}, {}, {}]);
|
|
proxy.order("top");
|
|
expect(testElements).toEqual([{}, {}, {}, testElement]);
|
|
});
|
|
|
|
it("ensures x/y values are non-negative", function () {
|
|
proxy.x(-1);
|
|
proxy.y(-400);
|
|
expect(proxy.x()).toEqual(0);
|
|
expect(proxy.y()).toEqual(0);
|
|
});
|
|
});
|
|
}
|
|
);
|