-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(test): replace (tagged) bulleted text
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(`TextReplaceNestedBullets.pptx`); | ||
|
||
await pres | ||
.addSlide('TestNestedBullets.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('TestNestedBullets.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`); | ||
}); |