Refactor to separate classes in their specific files an tests improuvements for styles
This commit is contained in:
36
src/file/styles/style/style.spec.ts
Normal file
36
src/file/styles/style/style.spec.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { expect } from "chai";
|
||||
import { Formatter } from "export/formatter";
|
||||
import { Style } from "./style";
|
||||
|
||||
describe("Style", () => {
|
||||
describe("#constructor()", () => {
|
||||
it("should set the given properties", () => {
|
||||
const style = new Style({
|
||||
type: "paragraph",
|
||||
styleId: "myStyleId",
|
||||
default: true,
|
||||
});
|
||||
const tree = new Formatter().format(style);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId", "w:default": true } }],
|
||||
});
|
||||
});
|
||||
|
||||
it("should set the name of the style, if given", () => {
|
||||
const style = new Style(
|
||||
{
|
||||
type: "paragraph",
|
||||
styleId: "myStyleId",
|
||||
},
|
||||
"Style Name",
|
||||
);
|
||||
const tree = new Formatter().format(style);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:style": [
|
||||
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
|
||||
{ "w:name": [{ _attr: { "w:val": "Style Name" } }] },
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user