2020-07-15 14:11:26 +08:00
|
|
|
import { expect } from "chai";
|
|
|
|
|
2022-06-26 23:26:42 +01:00
|
|
|
import { Formatter } from "@export/formatter";
|
2020-07-15 14:11:26 +08:00
|
|
|
|
2022-08-31 08:59:27 +01:00
|
|
|
import { DocumentDefaults } from "./document-defaults";
|
|
|
|
|
2020-07-15 14:11:26 +08:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|