adds textDirection to table cells

This commit is contained in:
bs595r
2020-05-10 10:36:25 -07:00
parent 3eca81d3f5
commit 25a7ce3742
5 changed files with 93 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import { BorderStyle } from "file/styles";
import { ShadingType } from "../shading";
import { TableCell } from "./table-cell";
import { TableCellBorders, TableCellWidth, VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components";
import { TableCellBorders, TableCellWidth, TextDirection, VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components";
describe("TableCellBorders", () => {
describe("#prepForXml", () => {
@ -271,6 +271,34 @@ describe("TableCell", () => {
});
});
it("should create with text direction", () => {
const cell = new TableCell({
children: [],
textDirection: TextDirection.BOTTOMTOTOPLEFTTORIGHT,
});
const tree = new Formatter().format(cell);
expect(tree).to.deep.equal({
"w:tc": [
{
"w:tcPr": [
{
"w:textDirection": {
_attr: {
"w:val": "btLr",
},
},
},
],
},
{
"w:p": {},
},
],
});
});
it("should create with vertical merge", () => {
const cell = new TableCell({
children: [],