2018-06-08 16:03:04 +02:00
|
|
|
import { assert } from "chai";
|
|
|
|
|
2018-06-09 23:49:01 +01:00
|
|
|
import { HorizontalPositionAlign, HorizontalPositionRelativeFrom } from ".";
|
2018-06-08 16:03:04 +02:00
|
|
|
import { Utility } from "../../../tests/utility";
|
2018-06-09 23:49:01 +01:00
|
|
|
import { HorizontalPosition } from "./horizontal-position";
|
2018-06-08 16:03:04 +02:00
|
|
|
|
|
|
|
describe("HorizontalPosition", () => {
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create a element with position align", () => {
|
|
|
|
const newJson = Utility.jsonify(
|
|
|
|
new HorizontalPosition({
|
|
|
|
relative: HorizontalPositionRelativeFrom.MARGIN,
|
|
|
|
align: HorizontalPositionAlign.CENTER,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
assert.equal(newJson.rootKey, "wp:positionH");
|
|
|
|
assert.include(newJson.root[0].root, {
|
|
|
|
relativeFrom: "margin",
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.equal(newJson.root[1].rootKey, "wp:align");
|
|
|
|
assert.include(newJson.root[1].root, "center");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create a element with offset", () => {
|
|
|
|
const newJson = Utility.jsonify(
|
|
|
|
new HorizontalPosition({
|
|
|
|
relative: HorizontalPositionRelativeFrom.MARGIN,
|
|
|
|
offset: 40,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
assert.equal(newJson.rootKey, "wp:positionH");
|
|
|
|
assert.include(newJson.root[0].root, {
|
|
|
|
relativeFrom: "margin",
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.equal(newJson.root[1].rootKey, "wp:posOffset");
|
|
|
|
assert.include(newJson.root[1].root[0], 40);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|