@elisra-devops/docgen-skins 0.4.1 → 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 +2 -2
- package/bin/models/json/table/JSONTable.js +15 -5
- package/bin/models/json/table/JSONTable.js.map +1 -1
- package/bin/models/json/table/JSONTableCell.d.ts +3 -3
- package/bin/models/json/table/JSONTableCell.js +5 -3
- 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 +4 -4
- 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 +38 -6
- package/src/models/json/table/JSONTableCell.ts +11 -4
- package/src/models/json/table/JSONTableRow.ts +10 -5
- package/src/models/json/wordJsonModels.ts +10 -2
- package/src/snippets/free-runs.ts +17 -5
- package/src/test/skins.test.ts +74 -56
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
|
});
|