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

40 lines
1017 B
TypeScript
Raw Normal View History

2021-03-13 20:23:15 +00:00
import { expect } from "chai";
import { Formatter } from "@export/formatter";
2021-03-13 20:23:15 +00:00
import { CharacterSpacing, Color } from "./formatting";
2021-03-13 20:23:15 +00:00
describe("CharacterSpacing", () => {
2021-03-13 20:23:15 +00:00
describe("#constructor()", () => {
it("should create", () => {
const element = new CharacterSpacing(32);
2021-03-13 20:23:15 +00:00
const tree = new Formatter().format(element);
2021-03-13 20:23:15 +00:00
expect(tree).to.deep.equal({
"w:spacing": {
2021-03-13 20:23:15 +00:00
_attr: {
"w:val": 32,
},
},
});
});
});
});
describe("Color", () => {
describe("#constructor()", () => {
it("should create", () => {
const element = new Color("#FFFFFF");
const tree = new Formatter().format(element);
expect(tree).to.deep.equal({
"w:color": {
_attr: {
"w:val": "FFFFFF",
2021-03-13 20:23:15 +00:00
},
},
});
});
});
});