@elisra-devops/docgen-skins 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.d.ts +3 -3
- package/bin/index.js +10 -10
- package/bin/index.js.map +1 -1
- package/bin/models/json/paragraph/JSONRichTextParagraph.d.ts +1 -1
- package/bin/models/json/paragraph/JSONRichTextParagraph.js +6 -6
- package/bin/models/json/paragraph/JSONRichTextParagraph.js.map +1 -1
- package/bin/models/json/table/JSONTable.d.ts +3 -3
- package/bin/models/json/table/JSONTable.js +20 -10
- package/bin/models/json/table/JSONTable.js.map +1 -1
- package/bin/models/json/table/JSONTableCell.d.ts +4 -3
- package/bin/models/json/table/JSONTableCell.js +45 -31
- package/bin/models/json/table/JSONTableCell.js.map +1 -1
- package/bin/models/json/table/JSONTableRow.d.ts +3 -3
- package/bin/models/json/table/JSONTableRow.js +5 -5
- package/bin/models/json/table/JSONTableRow.js.map +1 -1
- package/bin/models/json/wordJsonModels.d.ts +6 -0
- package/bin/snippets/free-runs.js +14 -4
- package/bin/snippets/free-runs.js.map +1 -1
- package/bin/test/skins.test.js +61 -51
- package/bin/test/skins.test.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +41 -12
- package/src/models/json/paragraph/JSONRichTextParagraph.ts +14 -27
- package/src/models/json/table/JSONTable.ts +35 -15
- package/src/models/json/table/JSONTableCell.ts +69 -59
- package/src/models/json/table/JSONTableRow.ts +12 -13
- package/src/models/json/wordJsonModels.ts +10 -2
- package/src/snippets/free-runs.ts +17 -5
- package/src/test/skins.test.ts +74 -56
|
@@ -1,79 +1,83 @@
|
|
|
1
|
-
import { extname } from
|
|
1
|
+
import { extname } from 'path';
|
|
2
2
|
import {
|
|
3
3
|
TableCell,
|
|
4
|
+
Shading,
|
|
4
5
|
Run,
|
|
5
6
|
Attachment,
|
|
6
7
|
WIProperty,
|
|
7
8
|
MultipeValuesWIProperty,
|
|
8
9
|
StyleOptions,
|
|
9
10
|
JsonHtml,
|
|
10
|
-
} from
|
|
11
|
-
import JSONRun from
|
|
12
|
-
import logger from
|
|
11
|
+
} from '../wordJsonModels';
|
|
12
|
+
import JSONRun from '../JSONRun';
|
|
13
|
+
import logger from '../../../services/logger';
|
|
13
14
|
|
|
14
15
|
export default class JSONTableCell {
|
|
15
16
|
cell: TableCell;
|
|
16
|
-
constructor(data: WIProperty, tableStyles: StyleOptions) {
|
|
17
|
-
this.cell = this.generateJsonCell(data, tableStyles);
|
|
17
|
+
constructor(data: WIProperty, tableStyles: StyleOptions, retrieveOriginal = false, shading = undefined) {
|
|
18
|
+
this.cell = this.generateJsonCell(data, tableStyles, retrieveOriginal, shading);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private removeFileExtension(filePath) {
|
|
22
|
+
const lastDotIndex = filePath.lastIndexOf('.');
|
|
23
|
+
if (lastDotIndex > 0) {
|
|
24
|
+
return filePath.slice(0, lastDotIndex);
|
|
25
|
+
}
|
|
26
|
+
return filePath; // If there's no extension, return the original file path
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
generateJsonCell(
|
|
21
30
|
data: WIProperty | MultipeValuesWIProperty,
|
|
22
|
-
styles
|
|
31
|
+
styles,
|
|
32
|
+
retrieveOriginal,
|
|
33
|
+
shading: Shading
|
|
23
34
|
): TableCell {
|
|
24
35
|
let runs: Run[] = [];
|
|
25
36
|
let attachments: Attachment[] = [];
|
|
26
|
-
let HtmlData: string =
|
|
27
|
-
|
|
37
|
+
let HtmlData: string = '';
|
|
28
38
|
//multiple values
|
|
29
|
-
if (
|
|
30
|
-
typeof data.value !== "string" &&
|
|
31
|
-
typeof data.value !== "number" &&
|
|
32
|
-
data.value
|
|
33
|
-
) {
|
|
39
|
+
if (typeof data.value !== 'string' && typeof data.value !== 'number' && data.value) {
|
|
34
40
|
data.value.forEach((runData) => {
|
|
35
41
|
//check if photo type
|
|
36
|
-
if (
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
if (runData.attachmentLink) {
|
|
43
|
+
let attachmentLink = retrieveOriginal ? runData.attachmentLink : runData.tableCellAttachmentLink;
|
|
44
|
+
if (this.isPictureUri(attachmentLink)) {
|
|
45
|
+
let attachment = {
|
|
46
|
+
type: 'Picture',
|
|
47
|
+
path: attachmentLink,
|
|
48
|
+
name: this.removeFileExtension(runData.attachmentFileName),
|
|
49
|
+
};
|
|
50
|
+
attachments.push(attachment);
|
|
51
|
+
} else {
|
|
52
|
+
let attachment = {
|
|
53
|
+
type: 'File',
|
|
54
|
+
path: runData.attachmentLink,
|
|
55
|
+
name: this.removeFileExtension(runData.attachmentFileName),
|
|
56
|
+
};
|
|
57
|
+
attachments.push(attachment);
|
|
58
|
+
}
|
|
59
|
+
} else if (/<[^>]*>/.test(runData.value)) {
|
|
60
|
+
HtmlData = runData.value || '';
|
|
61
|
+
} else {
|
|
62
|
+
styles.Uri = runData.relativeUrl ? runData.relativeUrl : runData.Uri ? runData.Uri : null;
|
|
52
63
|
styles.InsertLineBreak = false;
|
|
53
64
|
let jsonRun = new JSONRun(runData.value, styles);
|
|
54
65
|
runs = [...runs, ...jsonRun.getRun()];
|
|
55
66
|
}
|
|
56
67
|
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
styles.Uri = data.relativeUrl
|
|
63
|
-
? data.relativeUrl
|
|
64
|
-
: data.url
|
|
65
|
-
? data.url
|
|
66
|
-
: null;
|
|
67
|
-
let text = data.value || "";
|
|
68
|
+
} else if (/<[^>]*>/.test(data.value)) {
|
|
69
|
+
HtmlData = data.value || '';
|
|
70
|
+
} else {
|
|
71
|
+
styles.Uri = data.relativeUrl ? data.relativeUrl : data.url ? data.url : null;
|
|
72
|
+
let text = data.value || '';
|
|
68
73
|
let jsonRun = new JSONRun(`${text}`, styles);
|
|
69
74
|
runs = [...runs, ...jsonRun.getRun()];
|
|
70
75
|
}
|
|
71
|
-
if (HtmlData!=
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
76
|
+
if (HtmlData != '') {
|
|
77
|
+
let Html: JsonHtml = {
|
|
78
|
+
type: 'html',
|
|
79
|
+
Html: HtmlData,
|
|
80
|
+
};
|
|
77
81
|
return {
|
|
78
82
|
attachments: attachments,
|
|
79
83
|
Paragraphs: [
|
|
@@ -81,26 +85,32 @@ export default class JSONTableCell {
|
|
|
81
85
|
Runs: runs,
|
|
82
86
|
},
|
|
83
87
|
],
|
|
84
|
-
Html
|
|
88
|
+
Html,
|
|
89
|
+
shading: shading,
|
|
85
90
|
};
|
|
86
|
-
}
|
|
87
|
-
else{
|
|
91
|
+
} else {
|
|
88
92
|
return {
|
|
89
93
|
attachments: attachments,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
94
|
+
Paragraphs: [
|
|
95
|
+
{
|
|
96
|
+
Runs: runs,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
shading: shading,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
} //generateJsonCells
|
|
98
103
|
|
|
99
104
|
isPictureUri(uri: string) {
|
|
100
105
|
try {
|
|
101
106
|
let fileExt = extname(uri);
|
|
102
107
|
logger.debug(`attachment extension: ${fileExt}`);
|
|
103
|
-
if (
|
|
108
|
+
if (
|
|
109
|
+
fileExt.toUpperCase() == '.PNG' ||
|
|
110
|
+
fileExt.toUpperCase() == '.JPG' ||
|
|
111
|
+
fileExt.toUpperCase() == '.JPEG' ||
|
|
112
|
+
fileExt.toUpperCase() == '.GIF'
|
|
113
|
+
) {
|
|
104
114
|
return true;
|
|
105
115
|
} else {
|
|
106
116
|
return false;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
TableCell,
|
|
4
|
-
WIData,
|
|
5
|
-
WIProperty,
|
|
6
|
-
StyleOptions
|
|
7
|
-
} from "../wordJsonModels";
|
|
8
|
-
import JSONTableCell from "./JSONTableCell";
|
|
1
|
+
import { TableRow, TableCell, WIData, WIProperty, StyleOptions, Shading } from '../wordJsonModels';
|
|
2
|
+
import JSONTableCell from './JSONTableCell';
|
|
9
3
|
|
|
10
4
|
export default class JSONTableRow {
|
|
11
5
|
row: TableRow;
|
|
12
6
|
|
|
13
|
-
constructor(
|
|
14
|
-
|
|
7
|
+
constructor(
|
|
8
|
+
data: WIData,
|
|
9
|
+
tableStyles: StyleOptions,
|
|
10
|
+
retrieveOriginal = false,
|
|
11
|
+
shading: Shading = undefined
|
|
12
|
+
) {
|
|
13
|
+
this.row = this.generateJsonRow(data, tableStyles, retrieveOriginal, shading);
|
|
15
14
|
} //constructor
|
|
16
15
|
|
|
17
|
-
generateJsonRow(data: WIData, styles: StyleOptions): TableRow {
|
|
16
|
+
generateJsonRow(data: WIData, styles: StyleOptions, retrieveOriginal: boolean, shading: Shading): TableRow {
|
|
18
17
|
let tableCells: TableCell[] = [];
|
|
19
18
|
|
|
20
19
|
data.fields.forEach((wiProperty: WIProperty) => {
|
|
21
|
-
if (wiProperty.name ===
|
|
20
|
+
if (wiProperty.name === 'id') {
|
|
22
21
|
styles.Uri = data.url;
|
|
23
22
|
}
|
|
24
|
-
let jsonTableCell = new JSONTableCell(wiProperty, styles);
|
|
23
|
+
let jsonTableCell = new JSONTableCell(wiProperty, styles, retrieveOriginal, shading);
|
|
25
24
|
tableCells.push(JSON.parse(JSON.stringify(jsonTableCell.getJsonCell())));
|
|
26
25
|
});
|
|
27
26
|
|
|
@@ -28,10 +28,18 @@ export interface TableCell {
|
|
|
28
28
|
Paragraphs: [
|
|
29
29
|
{
|
|
30
30
|
Runs: Run[];
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
];
|
|
33
|
-
|
|
33
|
+
shading?: Shading;
|
|
34
|
+
Html?: JsonHtml;
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
export interface Shading {
|
|
38
|
+
color: string;
|
|
39
|
+
fill: string;
|
|
40
|
+
themeFillShade: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
export interface Paragraph {
|
|
36
44
|
type: string;
|
|
37
45
|
headingLevel?: number;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
import Skins from
|
|
1
|
+
import Skins from '../index';
|
|
2
2
|
|
|
3
3
|
let main = async () => {
|
|
4
|
+
let headerStyles = {
|
|
5
|
+
isBold: true,
|
|
6
|
+
IsItalic: false,
|
|
7
|
+
IsUnderline: false,
|
|
8
|
+
Size: 12,
|
|
9
|
+
Uri: null,
|
|
10
|
+
Font: 'Arial',
|
|
11
|
+
InsertLineBreak: false,
|
|
12
|
+
InsertSpace: true,
|
|
13
|
+
};
|
|
14
|
+
|
|
4
15
|
let styles = {
|
|
5
16
|
isBold: false,
|
|
6
17
|
IsItalic: false,
|
|
7
18
|
IsUnderline: false,
|
|
8
19
|
Size: 12,
|
|
9
20
|
Uri: null,
|
|
10
|
-
Font:
|
|
21
|
+
Font: 'Arial',
|
|
11
22
|
InsertLineBreak: false,
|
|
12
23
|
InsertSpace: true,
|
|
13
24
|
};
|
|
14
25
|
|
|
15
|
-
let skins = new Skins(
|
|
16
|
-
const QueryData = require(
|
|
26
|
+
let skins = new Skins('json', 'c:\test.dotx');
|
|
27
|
+
const QueryData = require('../../samples/mock-data/queries/flat-query-data.json');
|
|
17
28
|
await skins.addNewContentToDocumentSkin(
|
|
18
|
-
|
|
29
|
+
'test',
|
|
19
30
|
skins.SKIN_TYPE_PARAGRAPH,
|
|
20
31
|
QueryData,
|
|
32
|
+
headerStyles,
|
|
21
33
|
styles,
|
|
22
34
|
4
|
|
23
35
|
);
|
package/src/test/skins.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { writeFileSync } from
|
|
2
|
-
import Skins from
|
|
1
|
+
import { writeFileSync } from 'fs';
|
|
2
|
+
import Skins from '../index';
|
|
3
3
|
jest.setTimeout(300000);
|
|
4
4
|
const styles = {
|
|
5
5
|
isBold: false,
|
|
@@ -7,47 +7,61 @@ const styles = {
|
|
|
7
7
|
IsUnderline: false,
|
|
8
8
|
Size: 10,
|
|
9
9
|
Uri: null,
|
|
10
|
-
Font:
|
|
10
|
+
Font: 'New Times Roman',
|
|
11
11
|
InsertLineBreak: true,
|
|
12
12
|
InsertSpace: true,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const headerStyles = {
|
|
16
|
+
isBold: true,
|
|
17
|
+
IsItalic: false,
|
|
18
|
+
IsUnderline: false,
|
|
19
|
+
Size: 12,
|
|
20
|
+
Uri: null,
|
|
21
|
+
Font: 'Arial',
|
|
22
|
+
InsertLineBreak: false,
|
|
23
|
+
InsertSpace: true,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
describe('Generate json skins from queries - tests', () => {
|
|
27
|
+
test('generate table skin - flat query', async () => {
|
|
28
|
+
let skins = new Skins('json', 'c:\test.dotx');
|
|
29
|
+
const QueryData = require('../../samples/mock-data/queries/flat-query-data.json');
|
|
19
30
|
await skins.addNewContentToDocumentSkin(
|
|
20
|
-
|
|
31
|
+
'test',
|
|
21
32
|
skins.SKIN_TYPE_TABLE,
|
|
22
33
|
QueryData,
|
|
34
|
+
headerStyles,
|
|
23
35
|
styles,
|
|
24
36
|
4
|
|
25
37
|
);
|
|
26
38
|
const documentSkin: any = skins.getDocumentSkin();
|
|
27
|
-
const SnapShot = require(
|
|
39
|
+
const SnapShot = require('../../samples/snapshots/queries/flat-query-table-snapshot.json');
|
|
28
40
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
29
41
|
});
|
|
30
|
-
test(
|
|
31
|
-
let skins = new Skins(
|
|
32
|
-
const QueryData = require(
|
|
42
|
+
test('generate table skin - tree query', async () => {
|
|
43
|
+
let skins = new Skins('json', 'c:\test.dotx');
|
|
44
|
+
const QueryData = require('../../samples/mock-data/queries/tree-query-data.json');
|
|
33
45
|
await skins.addNewContentToDocumentSkin(
|
|
34
|
-
|
|
46
|
+
'test',
|
|
35
47
|
skins.SKIN_TYPE_TABLE,
|
|
36
48
|
QueryData,
|
|
49
|
+
headerStyles,
|
|
37
50
|
styles,
|
|
38
51
|
4
|
|
39
52
|
);
|
|
40
53
|
const documentSkin: any = skins.getDocumentSkin();
|
|
41
|
-
const SnapShot = require(
|
|
54
|
+
const SnapShot = require('../../samples/snapshots/queries/tree-query-table-snapshot.json');
|
|
42
55
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
43
56
|
});
|
|
44
|
-
test(
|
|
45
|
-
let skins = new Skins(
|
|
46
|
-
const QueryData = require(
|
|
57
|
+
test('generate paragraph skin - flat query', async () => {
|
|
58
|
+
let skins = new Skins('json', 'c:\test.dotx');
|
|
59
|
+
const QueryData = require('../../samples/mock-data/queries/flat-query-data.json');
|
|
47
60
|
await skins.addNewContentToDocumentSkin(
|
|
48
|
-
|
|
61
|
+
'test',
|
|
49
62
|
skins.SKIN_TYPE_PARAGRAPH,
|
|
50
63
|
QueryData,
|
|
64
|
+
headerStyles,
|
|
51
65
|
styles,
|
|
52
66
|
4
|
|
53
67
|
);
|
|
@@ -56,116 +70,120 @@ describe("Generate json skins from queries - tests", () => {
|
|
|
56
70
|
// "flat-query-paragraph-snapshot.json",
|
|
57
71
|
// JSON.stringify(documentSkin)
|
|
58
72
|
// );
|
|
59
|
-
const SnapShot = require(
|
|
73
|
+
const SnapShot = require('../../samples/snapshots/queries/flat-query-paragraph-snapshot.json');
|
|
60
74
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
61
75
|
});
|
|
62
|
-
test(
|
|
63
|
-
let skins = new Skins(
|
|
64
|
-
const QueryData = require(
|
|
76
|
+
test('generate paragraph skin - tree query', async () => {
|
|
77
|
+
let skins = new Skins('json', 'c:\test.dotx');
|
|
78
|
+
const QueryData = require('../../samples/mock-data/queries/tree-query-data.json');
|
|
65
79
|
await skins.addNewContentToDocumentSkin(
|
|
66
|
-
|
|
80
|
+
'test',
|
|
67
81
|
skins.SKIN_TYPE_PARAGRAPH,
|
|
68
82
|
QueryData,
|
|
83
|
+
headerStyles,
|
|
69
84
|
styles,
|
|
70
85
|
4
|
|
71
86
|
);
|
|
72
87
|
const documentSkin: any = skins.getDocumentSkin();
|
|
73
88
|
// writeFileSync("tree-query-data.json", JSON.stringify(documentSkin));
|
|
74
|
-
const SnapShot = require(
|
|
89
|
+
const SnapShot = require('../../samples/snapshots/queries/tree-query-paragraph-snapshot.json');
|
|
75
90
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
76
91
|
});
|
|
77
92
|
});
|
|
78
|
-
describe(
|
|
79
|
-
test(
|
|
80
|
-
let skins = new Skins(
|
|
81
|
-
const QueryData = require(
|
|
93
|
+
describe('Generate json skins from testData - tests', () => {
|
|
94
|
+
test('generate std skin - testData', async () => {
|
|
95
|
+
let skins = new Skins('json', 'c:\\\\test\\\\test.dotx');
|
|
96
|
+
const QueryData = require('../../samples/mock-data/test-data/testContentData.json');
|
|
82
97
|
await skins.addNewContentToDocumentSkin(
|
|
83
|
-
|
|
98
|
+
'system-capabilities',
|
|
84
99
|
skins.SKIN_TYPE_TEST_PLAN,
|
|
85
100
|
QueryData,
|
|
101
|
+
headerStyles,
|
|
86
102
|
styles,
|
|
87
103
|
4
|
|
88
104
|
);
|
|
89
105
|
const documentSkin: any = skins.getDocumentSkin();
|
|
90
106
|
|
|
91
|
-
const SnapShot = require(
|
|
107
|
+
const SnapShot = require('../../samples/snapshots/tests/flat-test-std-snapshot.json');
|
|
92
108
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
93
109
|
});
|
|
94
|
-
test(
|
|
95
|
-
let skins = new Skins(
|
|
96
|
-
|
|
97
|
-
"C:\\\\docgen\\\\documents\\\\181020205911\\\\test.dotx"
|
|
98
|
-
);
|
|
99
|
-
const QueryData = require("../../samples/mock-data/test-data/complex-test-data-with-attachments.json");
|
|
110
|
+
test('generate std skin - complex testData', async () => {
|
|
111
|
+
let skins = new Skins('json', 'C:\\\\docgen\\\\documents\\\\181020205911\\\\test.dotx');
|
|
112
|
+
const QueryData = require('../../samples/mock-data/test-data/complex-test-data-with-attachments.json');
|
|
100
113
|
await skins.addNewContentToDocumentSkin(
|
|
101
|
-
|
|
114
|
+
'system-capabilities',
|
|
102
115
|
skins.SKIN_TYPE_TEST_PLAN,
|
|
103
116
|
QueryData,
|
|
117
|
+
headerStyles,
|
|
104
118
|
styles,
|
|
105
119
|
4
|
|
106
120
|
);
|
|
107
121
|
const documentSkin: any = skins.getDocumentSkin();
|
|
108
|
-
const SnapShot = require(
|
|
122
|
+
const SnapShot = require('../../samples/snapshots/tests/complex-test-std-snapshot.json');
|
|
109
123
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
110
124
|
});
|
|
111
|
-
test(
|
|
112
|
-
let skins = new Skins(
|
|
113
|
-
const QueryData = require(
|
|
125
|
+
test('generate trace table skin', async () => {
|
|
126
|
+
let skins = new Skins('json', 'c:\\test\\test.dotx');
|
|
127
|
+
const QueryData = require('../../samples/mock-data/test-data/test-trace-table-data.json');
|
|
114
128
|
|
|
115
129
|
await skins.addNewContentToDocumentSkin(
|
|
116
|
-
|
|
130
|
+
'system-capabilities',
|
|
117
131
|
skins.SKIN_TYPE_TABLE,
|
|
118
132
|
QueryData,
|
|
133
|
+
headerStyles,
|
|
119
134
|
styles,
|
|
120
135
|
4
|
|
121
136
|
);
|
|
122
137
|
const documentSkin: any = skins.getDocumentSkin();
|
|
123
|
-
const SnapShot = require(
|
|
138
|
+
const SnapShot = require('../../samples/snapshots/tests/test-trace-table-snapshot.json');
|
|
124
139
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
125
140
|
});
|
|
126
141
|
});
|
|
127
|
-
describe(
|
|
128
|
-
test(
|
|
129
|
-
let skins = new Skins(
|
|
130
|
-
const adoptedChangesData = require(
|
|
142
|
+
describe('Generate json skins svd - tests', () => {
|
|
143
|
+
test('generate changes between releases skin', async () => {
|
|
144
|
+
let skins = new Skins('json', 'c:\\test\\test.dotx');
|
|
145
|
+
const adoptedChangesData = require('../../samples/mock-data/changes/adoptedChanges.json');
|
|
131
146
|
|
|
132
147
|
for (let i = 0; i < adoptedChangesData.length; i++) {
|
|
133
148
|
let artifactChangesData = adoptedChangesData[i];
|
|
134
149
|
await skins.addNewContentToDocumentSkin(
|
|
135
|
-
|
|
150
|
+
'change-description-content-control',
|
|
136
151
|
skins.SKIN_TYPE_PARAGRAPH,
|
|
137
152
|
artifactChangesData.artifact,
|
|
153
|
+
headerStyles,
|
|
138
154
|
styles,
|
|
139
155
|
4
|
|
140
156
|
);
|
|
141
157
|
|
|
142
158
|
await skins.addNewContentToDocumentSkin(
|
|
143
|
-
|
|
159
|
+
'change-description-content-control',
|
|
144
160
|
skins.SKIN_TYPE_TABLE,
|
|
145
161
|
artifactChangesData.artifactChanges,
|
|
162
|
+
headerStyles,
|
|
146
163
|
styles,
|
|
147
164
|
4
|
|
148
165
|
);
|
|
149
166
|
}
|
|
150
167
|
|
|
151
168
|
const documentSkin: any = skins.getDocumentSkin();
|
|
152
|
-
const SnapShot = require(
|
|
169
|
+
const SnapShot = require('../../samples/snapshots/changes/changes-table-release-snapshot.json');
|
|
153
170
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
154
171
|
});
|
|
155
172
|
});
|
|
156
|
-
describe(
|
|
157
|
-
test(
|
|
158
|
-
let skins = new Skins(
|
|
159
|
-
const QueryData = require(
|
|
173
|
+
describe('Common functions - tests', () => {
|
|
174
|
+
test('generate richText skin', async () => {
|
|
175
|
+
let skins = new Skins('json', 'c:\\\\test\\\\test.dotx');
|
|
176
|
+
const QueryData = require('../../samples/mock-data/test-data/testContentDataWithRichText.json');
|
|
160
177
|
await skins.addNewContentToDocumentSkin(
|
|
161
|
-
|
|
178
|
+
'system-capabilities',
|
|
162
179
|
skins.SKIN_TYPE_TEST_PLAN,
|
|
163
180
|
QueryData,
|
|
181
|
+
headerStyles,
|
|
164
182
|
styles,
|
|
165
183
|
4
|
|
166
184
|
);
|
|
167
185
|
const documentSkin: any = skins.getDocumentSkin();
|
|
168
|
-
const SnapShot = require(
|
|
186
|
+
const SnapShot = require('../../samples/snapshots/common/rich-text-test-std.json');
|
|
169
187
|
expect(documentSkin).toMatchObject(SnapShot);
|
|
170
188
|
});
|
|
171
189
|
});
|