2019-06-26 02:11:43 +01:00
|
|
|
import { expect } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
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
|
|
|
});
|
2017-03-09 12:42:19 +01:00
|
|
|
|
|
|
|
it("should default to 'single' and no color", () => {
|
2021-05-24 17:12:10 +03:00
|
|
|
const underline = new Underline();
|
2017-03-09 12:42:19 +01:00
|
|
|
const tree = new Formatter().format(underline);
|
|
|
|
expect(tree).to.deep.equal({
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:u": { _attr: { "w:val": "single" } },
|
2017-03-09 12:42:19 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should use the given style type and color", () => {
|
2021-05-24 17:12:10 +03:00
|
|
|
const underline = new Underline(UnderlineType.DOUBLE, "FF00CC");
|
2017-03-09 12:42:19 +01:00
|
|
|
const tree = new Formatter().format(underline);
|
|
|
|
expect(tree).to.deep.equal({
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:u": { _attr: { "w:val": "double", "w:color": "FF00CC" } },
|
2017-03-09 12:42:19 +01:00
|
|
|
});
|
|
|
|
});
|
2016-07-13 00:59:53 +01:00
|
|
|
});
|
|
|
|
});
|