2015-02-19 20:19:46 +00:00
|
|
|
/*global define,describe,it,expect,beforeEach,jasmine*/
|
|
|
|
|
|
|
|
define(
|
|
|
|
['../../src/elements/ElementProxy'],
|
|
|
|
function (ElementProxy) {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
describe("A fixed position element proxy", function () {
|
2015-02-19 21:29:43 +00:00
|
|
|
var testElement,
|
|
|
|
testElements,
|
|
|
|
proxy;
|
2015-02-19 20:19:46 +00:00
|
|
|
|
2015-02-19 21:29:43 +00:00
|
|
|
beforeEach(function () {
|
|
|
|
testElement = {
|
|
|
|
x: 1,
|
|
|
|
y: 2,
|
|
|
|
z: 3,
|
|
|
|
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([{}, {}, {}]);
|
|
|
|
});
|
2015-02-23 18:33:27 +00:00
|
|
|
|
|
|
|
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]);
|
|
|
|
});
|
2015-02-19 20:19:46 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|