add support for floating drawings
- added need elements and test for them
This commit is contained in:
41
src/file/drawing/floating/vertical-position.spec.ts
Normal file
41
src/file/drawing/floating/vertical-position.spec.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { assert } from "chai";
|
||||
|
||||
import { VerticalPosition } from "./vertical-position";
|
||||
import { Utility } from "../../../tests/utility";
|
||||
import { VerticalPositionRelativeFrom, VerticalPositionAlign } from ".";
|
||||
|
||||
describe("VerticalPosition", () => {
|
||||
describe("#constructor()", () => {
|
||||
it("should create a element with position align", () => {
|
||||
const newJson = Utility.jsonify(
|
||||
new VerticalPosition({
|
||||
relative: VerticalPositionRelativeFrom.MARGIN,
|
||||
align: VerticalPositionAlign.INSIDE,
|
||||
}),
|
||||
);
|
||||
assert.equal(newJson.rootKey, "wp:positionV");
|
||||
assert.include(newJson.root[0].root, {
|
||||
relativeFrom: "margin",
|
||||
});
|
||||
|
||||
assert.equal(newJson.root[1].rootKey, "wp:align");
|
||||
assert.include(newJson.root[1].root, "inside");
|
||||
});
|
||||
|
||||
it("should create a element with offset", () => {
|
||||
const newJson = Utility.jsonify(
|
||||
new VerticalPosition({
|
||||
relative: VerticalPositionRelativeFrom.MARGIN,
|
||||
offset: 40,
|
||||
}),
|
||||
);
|
||||
assert.equal(newJson.rootKey, "wp:positionV");
|
||||
assert.include(newJson.root[0].root, {
|
||||
relativeFrom: "margin",
|
||||
});
|
||||
|
||||
assert.equal(newJson.root[1].rootKey, "wp:posOffset");
|
||||
assert.include(newJson.root[1].root[0], 40);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user