Add shading to paragraph
This commit is contained in:
@ -9,6 +9,7 @@ import { File } from "../file";
|
||||
import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting";
|
||||
import { Bookmark, HyperlinkRef } from "./links";
|
||||
import { Paragraph } from "./paragraph";
|
||||
import { ShadingType } from "../table/shading";
|
||||
|
||||
describe("Paragraph", () => {
|
||||
describe("#constructor()", () => {
|
||||
@ -761,6 +762,36 @@ describe("Paragraph", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#shading", () => {
|
||||
it("should set paragraph outline level to the given value", () => {
|
||||
const paragraph = new Paragraph({
|
||||
shading: {
|
||||
type: ShadingType.REVERSE_DIAGONAL_STRIPE,
|
||||
color: "00FFFF",
|
||||
fill: "FF0000",
|
||||
},
|
||||
});
|
||||
const tree = new Formatter().format(paragraph);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:p": [
|
||||
{
|
||||
"w:pPr": [
|
||||
{
|
||||
"w:shd": {
|
||||
_attr: {
|
||||
"w:color": "00FFFF",
|
||||
"w:fill": "FF0000",
|
||||
"w:val": "reverseDiagStripe",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#prepForXml", () => {
|
||||
it("should set paragraph outline level to the given value", () => {
|
||||
const paragraph = new Paragraph({
|
||||
|
Reference in New Issue
Block a user