Files
docx-js/src/file/paragraph/run/underline.spec.ts

38 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-06-26 02:11:43 +01:00
import { expect } from "chai";
2018-10-26 01:04:07 +01:00
import { Formatter } from "export/formatter";
2021-05-24 17:12:10 +03:00
import { Underline, UnderlineType } from "./underline";
2016-07-13 00:59:53 +01:00
2016-07-13 18:49:02 +01:00
describe("Underline", () => {
2016-07-13 00:59:53 +01:00
describe("#constructor()", () => {
2016-07-13 18:49:02 +01:00
it("should create a new Underline object with u:u as the rootKey", () => {
2021-05-24 17:12:10 +03:00
const underline = new Underline();
2019-06-26 02:11:43 +01:00
const tree = new Formatter().format(underline);
expect(tree).to.deep.equal({
"w:u": {
_attr: {
"w:val": "single",
},
},
});
2016-07-13 00:59:53 +01:00
});
it("should default to 'single' and no color", () => {
2021-05-24 17:12:10 +03:00
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", () => {
2021-05-24 17:12:10 +03:00
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" } },
});
});
2016-07-13 00:59:53 +01:00
});
});