Skip to content

Commit a71a78b

Browse files
authored
Merge pull request #166 from OfficeDev/PPT-specific-API
Use a PPT-specific API for the task pane button
2 parents f022a54 + b7642cf commit a71a78b

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

package-lock.json

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/taskpane/powerpoint.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ export async function run() {
1919
*/
2020
await PowerPoint.run(async (context) => {
2121
const shapes = context.presentation.slides.getItemAt(0).shapes;
22-
const shapeOptions = {
23-
left: 100,
24-
top: 300,
25-
height: 300,
26-
width: 450,
27-
};
28-
const textbox = shapes.addTextBox("Hello World!", shapeOptions);
22+
const textbox = shapes.addTextBox("Hello World!");
23+
textbox.left = 100;
24+
textbox.top = 100;
25+
textbox.height = 300;
26+
textbox.width = 450;
2927
textbox.name = "GreetingTextbox";
3028
await context.sync();
3129
});

test/end-to-end/src/powerpoint-test-taskpane.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function getText(): Promise<string> {
2323
await context.sync();
2424

2525
const textboxShapes = shapes.items.filter(shape => shape.name === "GreetingTextbox");
26-
26+
2727
if (textboxShapes.length > 0) {
2828
const textFrame = textboxShapes[0].textFrame.load("textRange");
2929
await context.sync();
@@ -34,7 +34,6 @@ async function getText(): Promise<string> {
3434
}
3535
});
3636
}
37-
3837
export async function runTest(): Promise<void> {
3938
// Execute taskpane code
4039
await run();

test/unit/powerpoint.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const OfficeMockData = {
4646

4747
describe("PowerPoint", function () {
4848
it("Run", async function () {
49-
49+
5050
const pptMock: OfficeMockObject = new OfficeMockObject(PowerPointMockData); // Mocking the host specific namespace
5151
global.PowerPoint = pptMock as any;
5252
global.Office = new OfficeMockObject(OfficeMockData) as any; // Mocking the common office-js namespace
@@ -57,4 +57,4 @@ describe("PowerPoint", function () {
5757
// Check that a text box was added with the correct text
5858
assert.strictEqual(slide.shapes.items[0].textFrame.textRange.text, "Hello World!");
5959
});
60-
});
60+
});

0 commit comments

Comments
 (0)