#1487 Fix tests
This commit is contained in:
@ -82,5 +82,75 @@ describe("FrameProperties", () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should create without x and y", () => {
|
||||||
|
const currentFrameProperties = new FrameProperties({
|
||||||
|
width: 4000,
|
||||||
|
height: 1000,
|
||||||
|
anchor: {
|
||||||
|
horizontal: FrameAnchorType.MARGIN,
|
||||||
|
vertical: FrameAnchorType.MARGIN,
|
||||||
|
},
|
||||||
|
alignment: {
|
||||||
|
x: HorizontalPositionAlign.CENTER,
|
||||||
|
y: VerticalPositionAlign.TOP,
|
||||||
|
},
|
||||||
|
space: {
|
||||||
|
horizontal: 100,
|
||||||
|
vertical: 200,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const tree = new Formatter().format(currentFrameProperties);
|
||||||
|
expect(tree).to.deep.equal({
|
||||||
|
"w:framePr": {
|
||||||
|
_attr: {
|
||||||
|
"w:h": 1000,
|
||||||
|
"w:hAnchor": "margin",
|
||||||
|
"w:vAnchor": "margin",
|
||||||
|
"w:w": 4000,
|
||||||
|
"w:xAlign": "center",
|
||||||
|
"w:yAlign": "top",
|
||||||
|
"w:hSpace": 100,
|
||||||
|
"w:vSpace": 200,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should create without alignments", () => {
|
||||||
|
const currentFrameProperties = new FrameProperties({
|
||||||
|
position: {
|
||||||
|
x: 1000,
|
||||||
|
y: 3000,
|
||||||
|
},
|
||||||
|
width: 4000,
|
||||||
|
height: 1000,
|
||||||
|
anchor: {
|
||||||
|
horizontal: FrameAnchorType.MARGIN,
|
||||||
|
vertical: FrameAnchorType.MARGIN,
|
||||||
|
},
|
||||||
|
space: {
|
||||||
|
horizontal: 100,
|
||||||
|
vertical: 200,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const tree = new Formatter().format(currentFrameProperties);
|
||||||
|
expect(tree).to.deep.equal({
|
||||||
|
"w:framePr": {
|
||||||
|
_attr: {
|
||||||
|
"w:h": 1000,
|
||||||
|
"w:hAnchor": "margin",
|
||||||
|
"w:vAnchor": "margin",
|
||||||
|
"w:w": 4000,
|
||||||
|
"w:x": 1000,
|
||||||
|
"w:y": 3000,
|
||||||
|
"w:hSpace": 100,
|
||||||
|
"w:vSpace": 200,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -112,8 +112,8 @@ export class FrameProperties extends XmlComponent {
|
|||||||
spaceHorizontal: options.space?.horizontal,
|
spaceHorizontal: options.space?.horizontal,
|
||||||
spaceVertical: options.space?.vertical,
|
spaceVertical: options.space?.vertical,
|
||||||
rule: options.rule,
|
rule: options.rule,
|
||||||
alignmentX: (options as IAlignmentFrameOptions).alignment.x ? (options as IAlignmentFrameOptions).alignment.x : undefined,
|
alignmentX: (options as IAlignmentFrameOptions).alignment ? (options as IAlignmentFrameOptions).alignment.x : undefined,
|
||||||
alignmentY: (options as IAlignmentFrameOptions).alignment.x ? (options as IAlignmentFrameOptions).alignment.y : undefined,
|
alignmentY: (options as IAlignmentFrameOptions).alignment ? (options as IAlignmentFrameOptions).alignment.y : undefined,
|
||||||
lines: options.lines,
|
lines: options.lines,
|
||||||
wrap: options.wrap,
|
wrap: options.wrap,
|
||||||
}),
|
}),
|
||||||
|
Reference in New Issue
Block a user