remove more duplicate classes; add additional values functions; clean up tests
This commit is contained in:
@ -1,15 +0,0 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "export/formatter";
|
||||
|
||||
import { Bidirectional } from "./bidirectional";
|
||||
|
||||
describe("Bidirectional", () => {
|
||||
it("should create", () => {
|
||||
const bidirectional = new Bidirectional();
|
||||
const tree = new Formatter().format(bidirectional);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:bidi": {},
|
||||
});
|
||||
});
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class Bidirectional extends XmlComponent {
|
||||
constructor() {
|
||||
super("w:bidi");
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
export * from "./alignment";
|
||||
export * from "./border";
|
||||
export * from "./indent";
|
||||
export * from "./keep";
|
||||
export * from "./page-break";
|
||||
export * from "./spacing";
|
||||
export * from "./style";
|
||||
|
@ -1,13 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class KeepLines extends XmlComponent {
|
||||
constructor() {
|
||||
super("w:keepLines");
|
||||
}
|
||||
}
|
||||
|
||||
export class KeepNext extends XmlComponent {
|
||||
constructor() {
|
||||
super("w:keepNext");
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "export/formatter";
|
||||
|
||||
import { ContextualSpacing, Spacing } from "./spacing";
|
||||
import { Spacing } from "./spacing";
|
||||
|
||||
describe("Spacing", () => {
|
||||
describe("#constructor", () => {
|
||||
@ -23,23 +23,3 @@ describe("Spacing", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("ContextualSpacing", () => {
|
||||
describe("#constructor", () => {
|
||||
it("should create", () => {
|
||||
const spacing = new ContextualSpacing(true);
|
||||
const tree = new Formatter().format(spacing);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:contextualSpacing": { _attr: { "w:val": 1 } },
|
||||
});
|
||||
});
|
||||
|
||||
it("should create with value of 0 if param is false", () => {
|
||||
const spacing = new ContextualSpacing(false);
|
||||
const tree = new Formatter().format(spacing);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:contextualSpacing": { _attr: { "w:val": 0 } },
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
// http://officeopenxml.com/WPspacing.php
|
||||
import { Attributes, XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
export enum LineRuleType {
|
||||
AT_LEAST = "atLeast",
|
||||
@ -30,14 +30,3 @@ export class Spacing extends XmlComponent {
|
||||
this.root.push(new SpacingAttributes(options));
|
||||
}
|
||||
}
|
||||
|
||||
export class ContextualSpacing extends XmlComponent {
|
||||
constructor(value: boolean) {
|
||||
super("w:contextualSpacing");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
val: value === false ? 0 : 1,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "export/formatter";
|
||||
|
||||
import { WidowControl } from "./widow-control";
|
||||
|
||||
describe("WidowControl", () => {
|
||||
it("should create", () => {
|
||||
const widowControl = new WidowControl(true);
|
||||
const tree = new Formatter().format(widowControl);
|
||||
|
||||
expect(tree).to.deep.equal({
|
||||
"w:widowControl": {
|
||||
_attr: {
|
||||
"w:val": true,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
@ -1,13 +0,0 @@
|
||||
// http://www.datypic.com/sc/ooxml/e-w_widowControl-1.html
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
export class WidowControlAttributes extends XmlAttributeComponent<{ readonly val: boolean }> {
|
||||
protected readonly xmlKeys = { val: "w:val" };
|
||||
}
|
||||
|
||||
export class WidowControl extends XmlComponent {
|
||||
constructor(value: boolean) {
|
||||
super("w:widowControl");
|
||||
this.root.push(new WidowControlAttributes({ val: value }));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user