remove more duplicate classes; add additional values functions; clean up tests

This commit is contained in:
Tom Hunkapiller
2021-05-24 11:28:10 +03:00
parent a56119e7cd
commit ce2a0fb864
38 changed files with 311 additions and 362 deletions

View File

@ -66,7 +66,7 @@ describe("CharacterStyle", () => {
"w:style": [
{ _attr: { "w:type": "character", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:smallCaps": {} }],
},
{
"w:uiPriority": {
@ -94,7 +94,7 @@ describe("CharacterStyle", () => {
"w:style": [
{ _attr: { "w:type": "character", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:caps": {} }],
},
{
"w:uiPriority": {
@ -122,7 +122,7 @@ describe("CharacterStyle", () => {
"w:style": [
{ _attr: { "w:type": "character", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:strike": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:strike": {} }],
},
{
"w:uiPriority": {
@ -150,7 +150,7 @@ describe("CharacterStyle", () => {
"w:style": [
{ _attr: { "w:type": "character", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:dstrike": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:dstrike": {} }],
},
{
"w:uiPriority": {
@ -601,17 +601,17 @@ describe("CharacterStyle", () => {
const boldTests = [
{
bold: true,
expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }],
expected: [{ "w:b": {} }, { "w:bCs": {} }],
},
{
bold: true,
boldComplexScript: true,
expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }],
expected: [{ "w:b": {} }, { "w:bCs": {} }],
},
{
bold: true,
boldComplexScript: false,
expected: [{ "w:b": { _attr: { "w:val": true } } }],
expected: [{ "w:b": {} }],
},
];
boldTests.forEach(({ bold, boldComplexScript, expected }) => {
@ -645,17 +645,17 @@ describe("CharacterStyle", () => {
const italicsTests = [
{
italics: true,
expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }],
expected: [{ "w:i": {} }, { "w:iCs": {} }],
},
{
italics: true,
italicsComplexScript: true,
expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }],
expected: [{ "w:i": {} }, { "w:iCs": {} }],
},
{
italics: true,
italicsComplexScript: false,
expected: [{ "w:i": { _attr: { "w:val": true } } }],
expected: [{ "w:i": {} }],
},
];
italicsTests.forEach(({ italics, italicsComplexScript, expected }) => {

View File

@ -242,11 +242,7 @@ describe("ParagraphStyle", () => {
{
"w:pPr": [
{
"w:contextualSpacing": {
_attr: {
"w:val": 1,
},
},
"w:contextualSpacing": {},
},
],
},
@ -404,7 +400,7 @@ describe("ParagraphStyle", () => {
"w:style": [
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:smallCaps": {} }],
},
],
});
@ -422,7 +418,7 @@ describe("ParagraphStyle", () => {
"w:style": [
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:caps": {} }],
},
],
});
@ -440,7 +436,7 @@ describe("ParagraphStyle", () => {
"w:style": [
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:strike": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:strike": {} }],
},
],
});
@ -458,7 +454,7 @@ describe("ParagraphStyle", () => {
"w:style": [
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
{
"w:rPr": [{ "w:dstrike": { _attr: { "w:val": true } } }],
"w:rPr": [{ "w:dstrike": {} }],
},
],
});
@ -562,17 +558,17 @@ describe("ParagraphStyle", () => {
const boldTests = [
{
bold: true,
expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }],
expected: [{ "w:b": {} }, { "w:bCs": {} }],
},
{
bold: true,
boldComplexScript: true,
expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }],
expected: [{ "w:b": {} }, { "w:bCs": {} }],
},
{
bold: true,
boldComplexScript: false,
expected: [{ "w:b": { _attr: { "w:val": true } } }],
expected: [{ "w:b": {} }],
},
];
boldTests.forEach(({ bold, boldComplexScript, expected }) => {
@ -591,17 +587,17 @@ describe("ParagraphStyle", () => {
const italicsTests = [
{
italics: true,
expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }],
expected: [{ "w:i": {} }, { "w:iCs": {} }],
},
{
italics: true,
italicsComplexScript: true,
expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }],
expected: [{ "w:i": {} }, { "w:iCs": {} }],
},
{
italics: true,
italicsComplexScript: false,
expected: [{ "w:i": { _attr: { "w:val": true } } }],
expected: [{ "w:i": {} }],
},
];
italicsTests.forEach(({ italics, italicsComplexScript, expected }) => {