Skip to content

Commit 866ec77

Browse files
committed
chore(test): replace (tagged) bulleted text
1 parent d964d73 commit 866ec77

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
34.4 KB
Binary file not shown.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import Automizer, { modify } from '../src/index';
2+
3+
const bulletPoints = ['first line', 'second line', 'third line'].join(`\n`);
4+
const bulletPoints2 = ['first line-2', 'second line-2'].join(`\n`);
5+
6+
test('create presentation, replace tagged and untagged nested bulleted text.', async () => {
7+
const automizer = new Automizer({
8+
templateDir: `${__dirname}/pptx-templates`,
9+
outputDir: `${__dirname}/pptx-output`,
10+
removeExistingSlides: true,
11+
});
12+
13+
const pres = automizer
14+
.loadRoot(`RootTemplate.pptx`)
15+
.load(`TextReplaceNestedBullets.pptx`);
16+
17+
await pres
18+
.addSlide('TestNestedBullets.pptx', 1, (slide) => {
19+
slide.modifyElement(
20+
'@AutomateBullets',
21+
modify.replaceText(
22+
[
23+
{
24+
replace: 'bullet1',
25+
by: {
26+
text: bulletPoints,
27+
},
28+
},
29+
{
30+
replace: 'bullet2',
31+
by: {
32+
text: bulletPoints,
33+
},
34+
},
35+
{
36+
replace: 'bullet2-1',
37+
by: {
38+
text: bulletPoints2,
39+
},
40+
},
41+
],
42+
{
43+
openingTag: '{{',
44+
closingTag: '}}',
45+
},
46+
),
47+
);
48+
})
49+
.addSlide('TestNestedBullets.pptx', 2, (slide) => {
50+
slide.modifyElement(
51+
'@AutomateNestedBullets',
52+
modify.setBulletList([
53+
'Test1',
54+
'Test 2',
55+
['Test 3-1', 'Test 3-2', ['Test 3-3-1', 'Test 3-3-2']],
56+
'Test 4',
57+
]),
58+
);
59+
})
60+
.write(`replace-nested-bullets.test.pptx`);
61+
});

0 commit comments

Comments
 (0)