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