From 44b95f2f1567fd320860c1ef0d70c116cc0b737a Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 26 Sep 2019 02:14:52 +0100 Subject: [PATCH] Add shading test --- .../table-properties/table-properties.spec.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/file/table/table-properties/table-properties.spec.ts b/src/file/table/table-properties/table-properties.spec.ts index dbd1c6b371..960d117b7c 100644 --- a/src/file/table/table-properties/table-properties.spec.ts +++ b/src/file/table/table-properties/table-properties.spec.ts @@ -2,6 +2,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +import { ShadingType } from "../shading"; import { WidthType } from "../table-cell"; import { TableLayoutType } from "./table-layout"; import { TableProperties } from "./table-properties"; @@ -66,4 +67,29 @@ describe("TableProperties", () => { }); }); }); + + describe("#setShading", () => { + it("sets the shading of the table", () => { + const tp = new TableProperties(); + tp.setShading({ + fill: "b79c2f", + val: ShadingType.REVERSE_DIAGONAL_STRIPE, + color: "auto", + }); + const tree = new Formatter().format(tp); + expect(tree).to.deep.equal({ + "w:tblPr": [ + { + "w:shd": { + _attr: { + "w:color": "auto", + "w:fill": "b79c2f", + "w:val": "reverseDiagStripe", + }, + }, + }, + ], + }); + }); + }); });