|
| 1 | +// import * as ModifyBackground from '../src/modify/modify-background'; // Adjust |
| 2 | +// import Automizer from '../src/automizer'; |
| 3 | +// |
| 4 | +// describe('ModifyMasterBackground', () => { |
| 5 | +// beforeEach(() => { |
| 6 | +// // Initialize the automizer instance |
| 7 | +// const automizer = new Automizer({ |
| 8 | +// templateDir: `${__dirname}/pptx-templates`, |
| 9 | +// outputDir: `${__dirname}/pptx-output`, |
| 10 | +// }); |
| 11 | +// |
| 12 | +// const pres = await automizer |
| 13 | +// .loadRoot(`EmptyTemplate.pptx`) |
| 14 | +// }); |
| 15 | +// |
| 16 | +// test('should allow setting a background color on a master slide', async () => { |
| 17 | +// const masterId = 1; // Example master slide ID |
| 18 | +// const newColor = 'FF5733'; // Example new color |
| 19 | +// |
| 20 | +// // Modify the master slide by setting a new background color |
| 21 | +// await pres.addMaster(masterId, (master) => { |
| 22 | +// master.modifyBackground.setBackgroundColor(master, newColor); |
| 23 | +// }); |
| 24 | +// |
| 25 | +// // Later on we could add a way to getMasterInfo or something that could either be the raw xml, or more helpfully a {background:{backgroundImage:"",backgroundColor:""}} |
| 26 | +// // Retrieve the modified master slide and verify the background color |
| 27 | +// const modifiedMaster = await pres.getMasterInfo(masterId); |
| 28 | +// expect(modifiedMaster.backgroundColor).toBe(newColor); // Assuming the master slide object has a backgroundColor property |
| 29 | +// }); |
| 30 | +// |
| 31 | +// test('should allow setting a background image on a master slide', async () => { |
| 32 | +// const masterId = 1; // Example master slide ID |
| 33 | +// const newImage = 'path/to/new/image.jpg'; // Example new image path |
| 34 | +// |
| 35 | +// // Modify the master slide by setting a new background image |
| 36 | +// await automizer.addMaster(masterId, (master) => { |
| 37 | +// master.modifyBackground.setBackgroundImage(master, newImage); |
| 38 | +// }); |
| 39 | +// // Later on we could add a way to getMasterInfo or something that could either be the raw xml, or more helpfully a {background:{backgroundImage:"",backgroundColor:""}} |
| 40 | +// // Retrieve the modified master slide and verify the background image |
| 41 | +// const modifiedMaster = await pres.getMasterInfo(masterId); |
| 42 | +// expect(modifiedMaster.backgroundImage).toBe(newImage); // Assuming the master slide object has a backgroundImage property |
| 43 | +// }); |
| 44 | +// |
| 45 | +// // Additional tests for edge cases, error handling, etc. |
| 46 | +// }); |
0 commit comments