:test: document defaults & numbering suffix
This commit is contained in:
@ -7,6 +7,7 @@ import { AlignmentType, EmphasisMarkType, TabStopPosition } from "../paragraph";
|
|||||||
import { UnderlineType } from "../paragraph/run/underline";
|
import { UnderlineType } from "../paragraph/run/underline";
|
||||||
import { ShadingType } from "../table";
|
import { ShadingType } from "../table";
|
||||||
import { AbstractNumbering } from "./abstract-numbering";
|
import { AbstractNumbering } from "./abstract-numbering";
|
||||||
|
import { LevelSuffix } from "./level";
|
||||||
|
|
||||||
describe("AbstractNumbering", () => {
|
describe("AbstractNumbering", () => {
|
||||||
it("stores its ID at its .id property", () => {
|
it("stores its ID at its .id property", () => {
|
||||||
@ -48,6 +49,20 @@ describe("AbstractNumbering", () => {
|
|||||||
expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } });
|
expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("has suffix", () => {
|
||||||
|
const abstractNumbering = new AbstractNumbering(1, [
|
||||||
|
{
|
||||||
|
level: 3,
|
||||||
|
format: "lowerLetter",
|
||||||
|
text: "%1)",
|
||||||
|
alignment: AlignmentType.END,
|
||||||
|
suffix: LevelSuffix.SPACE,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const tree = new Formatter().format(abstractNumbering);
|
||||||
|
expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:suff": { _attr: { "w:val": "space" } } });
|
||||||
|
});
|
||||||
|
|
||||||
describe("formatting methods: paragraph properties", () => {
|
describe("formatting methods: paragraph properties", () => {
|
||||||
it("#indent", () => {
|
it("#indent", () => {
|
||||||
const abstractNumbering = new AbstractNumbering(1, [
|
const abstractNumbering = new AbstractNumbering(1, [
|
||||||
|
45
src/file/styles/defaults/document-defaults.spec.ts
Normal file
45
src/file/styles/defaults/document-defaults.spec.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { expect } from "chai";
|
||||||
|
|
||||||
|
import { DocumentDefaults } from "./document-defaults";
|
||||||
|
|
||||||
|
import { Formatter } from "export/formatter";
|
||||||
|
|
||||||
|
describe("DocumentDefaults", () => {
|
||||||
|
it("#constructor", () => {
|
||||||
|
const defaults = new DocumentDefaults({
|
||||||
|
paragraph: { spacing: { line: 240 } },
|
||||||
|
run: { color: "808080" },
|
||||||
|
});
|
||||||
|
const tree = new Formatter().format(defaults);
|
||||||
|
expect(tree).to.deep.equal({
|
||||||
|
"w:docDefaults": [
|
||||||
|
{
|
||||||
|
"w:rPrDefault": [
|
||||||
|
{
|
||||||
|
"w:rPr": [
|
||||||
|
{
|
||||||
|
"w:color": { _attr: { "w:val": "808080" } },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"w:pPrDefault": [
|
||||||
|
{
|
||||||
|
"w:pPr": [
|
||||||
|
{
|
||||||
|
"w:spacing": {
|
||||||
|
_attr: {
|
||||||
|
"w:line": 240,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user