2019-06-26 22:12:18 +01:00
|
|
|
import { expect } from "chai";
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2019-06-26 22:12:18 +01:00
|
|
|
import { Formatter } from "export/formatter";
|
2021-03-14 17:00:42 +00:00
|
|
|
import { VerticalPositionAlign } from "file/shared/alignment";
|
2018-10-26 01:04:07 +01:00
|
|
|
|
2021-03-14 17:00:42 +00:00
|
|
|
import { VerticalPositionRelativeFrom } from "./floating-position";
|
2018-06-09 23:49:01 +01:00
|
|
|
import { VerticalPosition } from "./vertical-position";
|
2018-06-08 16:03:04 +02:00
|
|
|
|
|
|
|
describe("VerticalPosition", () => {
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create a element with position align", () => {
|
2019-06-26 22:12:18 +01:00
|
|
|
const tree = new Formatter().format(
|
2018-06-08 16:03:04 +02:00
|
|
|
new VerticalPosition({
|
|
|
|
relative: VerticalPositionRelativeFrom.MARGIN,
|
|
|
|
align: VerticalPositionAlign.INSIDE,
|
|
|
|
}),
|
|
|
|
);
|
2019-06-26 22:12:18 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"wp:positionV": [
|
|
|
|
{
|
|
|
|
_attr: {
|
|
|
|
relativeFrom: "margin",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"wp:align": ["inside"],
|
|
|
|
},
|
|
|
|
],
|
2018-06-08 16:03:04 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create a element with offset", () => {
|
2019-06-26 22:12:18 +01:00
|
|
|
const tree = new Formatter().format(
|
2018-06-08 16:03:04 +02:00
|
|
|
new VerticalPosition({
|
|
|
|
relative: VerticalPositionRelativeFrom.MARGIN,
|
|
|
|
offset: 40,
|
|
|
|
}),
|
|
|
|
);
|
2019-06-26 22:12:18 +01:00
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"wp:positionV": [
|
|
|
|
{
|
|
|
|
_attr: {
|
|
|
|
relativeFrom: "margin",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"wp:posOffset": ["40"],
|
|
|
|
},
|
|
|
|
],
|
2018-06-08 16:03:04 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|