Files
docx-js/src/file/border/border.spec.ts
Dolan Miu 982d923553 Improve import alias
@file/ and @export/ instead of file/ and export/ etc
2022-06-26 23:26:42 +01:00

55 lines
1.7 KiB
TypeScript

import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { BorderStyle } from "@file/border";
import { BorderElement } from "./border";
describe("BorderElement", () => {
describe("#constructor", () => {
it("should create a simple border element", () => {
const border = new BorderElement("w:top", {
style: BorderStyle.SINGLE,
});
const tree = new Formatter().format(border);
expect(tree).to.deep.equal({
"w:top": {
_attr: {
"w:val": "single",
},
},
});
});
it("should create a simple border element with a size", () => {
const border = new BorderElement("w:top", {
style: BorderStyle.SINGLE,
size: 22,
});
const tree = new Formatter().format(border);
expect(tree).to.deep.equal({
"w:top": {
_attr: {
"w:val": "single",
"w:sz": 22,
},
},
});
});
it("should create a simple border element with space", () => {
const border = new BorderElement("w:top", {
style: BorderStyle.SINGLE,
space: 22,
});
const tree = new Formatter().format(border);
expect(tree).to.deep.equal({
"w:top": {
_attr: {
"w:val": "single",
"w:space": 22,
},
},
});
});
});
});