Files
docx-js/src/file/table/table-properties/table-float-properties.spec.ts

45 lines
1.5 KiB
TypeScript
Raw Normal View History

2018-10-23 09:08:43 -02:00
import { expect } from "chai";
2018-10-23 23:44:50 +01:00
import { Formatter } from "../../../export/formatter";
2018-10-23 09:08:43 -02:00
import { RelativeHorizontalPosition, RelativeVerticalPosition, TableAnchorType, TableFloatProperties } from "./table-float-properties";
describe("Table Float Properties", () => {
describe("#constructor", () => {
it("should construct a TableFloatProperties with all options", () => {
const tfp = new TableFloatProperties({
horizontalAnchor: TableAnchorType.MARGIN,
verticalAnchor: TableAnchorType.PAGE,
absoluteHorizontalPosition: 10,
relativeHorizontalPosition: RelativeHorizontalPosition.CENTER,
absoluteVerticalPosition: 20,
relativeVerticalPosition: RelativeVerticalPosition.BOTTOM,
bottomFromText: 30,
topFromText: 40,
leftFromText: 50,
rightFromText: 60,
});
const tree = new Formatter().format(tfp);
expect(tree).to.be.deep.equal(DEFAULT_TFP);
});
});
});
const DEFAULT_TFP = {
"w:tblpPr": [
{
_attr: {
"w:horzAnchor": "margin",
"w:vertAnchor": "page",
"w:tblpX": 10,
"w:tblpXSpec": "center",
"w:tblpY": 20,
"w:tblpYSpec": "bottom",
"w:bottomFromText": 30,
"w:topFromText": 40,
"w:leftFromText": 50,
"w:rightFromText": 60,
},
},
],
};