Files
docx-js/src/file/paragraph/run/underline.spec.ts
2021-05-24 17:12:10 +03:00

38 lines
1.2 KiB
TypeScript

import { expect } from "chai";
import { Formatter } from "export/formatter";
import { Underline, UnderlineType } from "./underline";
describe("Underline", () => {
describe("#constructor()", () => {
it("should create a new Underline object with u:u as the rootKey", () => {
const underline = new Underline();
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "single",
},
},
});
});
it("should default to 'single' and no color", () => {
const underline = new Underline();
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": { _attr: { "w:val": "single" } },
});
});
it("should use the given style type and color", () => {
const underline = new Underline(UnderlineType.DOUBLE, "FF00CC");
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": { _attr: { "w:val": "double", "w:color": "FF00CC" } },
});
});
});
});