2018-11-13 11:04:03 -02:00
|
|
|
import { expect } from "chai";
|
|
|
|
import { Formatter } from "export/formatter";
|
|
|
|
import * as defaultStyels from "./default-styles";
|
|
|
|
|
|
|
|
describe("Default Styles", () => {
|
|
|
|
it("HeadingStyle#constructor", () => {
|
|
|
|
const style = new defaultStyels.HeadingStyle("Heading1", "Heading 1");
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading1" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 1" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("TitleStyle#constructor", () => {
|
|
|
|
const style = new defaultStyels.TitleStyle();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Title" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Title" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Heading1Style#constructor", () => {
|
|
|
|
const style = new defaultStyels.Heading1Style();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading1" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 1" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Heading2Style#constructor", () => {
|
|
|
|
const style = new defaultStyels.Heading2Style();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading2" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 2" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Heading3Style#constructor", () => {
|
|
|
|
const style = new defaultStyels.Heading3Style();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading3" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 3" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Heading4Style#constructor", () => {
|
|
|
|
const style = new defaultStyels.Heading4Style();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading4" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 4" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Heading5Style#constructor", () => {
|
|
|
|
const style = new defaultStyels.Heading5Style();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading5" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 5" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Heading6Style#constructor", () => {
|
|
|
|
const style = new defaultStyels.Heading6Style();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "Heading6" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Heading 6" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:next": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("ListParagraph#constructor", () => {
|
|
|
|
const style = new defaultStyels.ListParagraph();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "ListParagraph" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "List Paragraph" } } },
|
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
2019-04-10 01:28:37 -04:00
|
|
|
{ "w:qFormat": {} },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("FootnoteText#constructor", () => {
|
|
|
|
const style = new defaultStyels.FootnoteText();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "paragraph", "w:styleId": "FootnoteText" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "footnote text" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
{
|
|
|
|
"w:pPr": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:spacing": {
|
|
|
|
_attr: {
|
|
|
|
"w:after": 0,
|
|
|
|
"w:line": 240,
|
|
|
|
"w:lineRule": "auto",
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:rPr": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:sz": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": 20,
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:szCs": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": 20,
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:basedOn": { _attr: { "w:val": "Normal" } } },
|
|
|
|
{ "w:link": { _attr: { "w:val": "FootnoteTextChar" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:uiPriority": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "99",
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:semiHidden": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:unhideWhenUsed": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("FootnoteReferenceStyle#constructor", () => {
|
|
|
|
const style = new defaultStyels.FootnoteReferenceStyle();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "character", "w:styleId": "FootnoteReference" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "footnote reference" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
{
|
|
|
|
"w:rPr": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:vertAlign": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "superscript",
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:uiPriority": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "99",
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:unhideWhenUsed": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:basedOn": { _attr: { "w:val": "DefaultParagraphFont" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
|
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:semiHidden": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("FootnoteTextChar#constructor", () => {
|
|
|
|
const style = new defaultStyels.FootnoteTextChar();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "character", "w:styleId": "FootnoteTextChar" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Footnote Text Char" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
{
|
|
|
|
"w:rPr": [
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:sz": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": 20,
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:szCs": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": 20,
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:uiPriority": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "99",
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:unhideWhenUsed": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:basedOn": { _attr: { "w:val": "DefaultParagraphFont" } } },
|
|
|
|
{ "w:link": { _attr: { "w:val": "FootnoteText" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:semiHidden": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("HyperlinkStyle#constructor", () => {
|
|
|
|
const style = new defaultStyels.HyperlinkStyle();
|
|
|
|
const tree = new Formatter().format(style);
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:style": [
|
|
|
|
{ _attr: { "w:type": "character", "w:styleId": "Hyperlink" } },
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:name": { _attr: { "w:val": "Hyperlink" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:rPr": [{ "w:color": { _attr: { "w:val": "0563C1" } } }, { "w:u": { _attr: { "w:val": "single" } } }],
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:uiPriority": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": "99",
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
|
|
|
{
|
2019-04-10 01:28:37 -04:00
|
|
|
"w:unhideWhenUsed": {},
|
2018-11-13 11:04:03 -02:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
{ "w:basedOn": { _attr: { "w:val": "DefaultParagraphFont" } } },
|
2018-11-13 11:04:03 -02:00
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|