Files
docx-js/src/file/drawing/floating/vertical-position.spec.ts

54 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-06-26 22:12:18 +01:00
import { expect } from "chai";
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";
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(
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"],
},
],
});
});
it("should create a element with offset", () => {
2019-06-26 22:12:18 +01:00
const tree = new Formatter().format(
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"],
},
],
});
});
});
});