diff --git a/packages/office-addin-mock/src/officeMockObject.ts b/packages/office-addin-mock/src/officeMockObject.ts index 81267f6b9..d50b3fd13 100644 --- a/packages/office-addin-mock/src/officeMockObject.ts +++ b/packages/office-addin-mock/src/officeMockObject.ts @@ -33,7 +33,7 @@ export class OfficeMockObject { } let properties: string[] = []; - if (propertyArgument === undefined) { + if (propertyArgument === undefined) { // an empty load call mean load all properties properties = ["*"]; } else if (typeof propertyArgument === "string") { @@ -47,6 +47,8 @@ export class OfficeMockObject { properties.forEach((property: string) => { this.loadMultipleProperties(property); }); + + return this; } /** diff --git a/packages/office-addin-mock/test/officeMockObject.test.ts b/packages/office-addin-mock/test/officeMockObject.test.ts index 19d870e21..9415cfdfd 100644 --- a/packages/office-addin-mock/test/officeMockObject.test.ts +++ b/packages/office-addin-mock/test/officeMockObject.test.ts @@ -95,6 +95,13 @@ describe("Test OfficeMockObject class", function() { assert.strictEqual(officeMock.notAProperty, undefined); }); + it("Load call with assignment", async function() { + const officeMock = new OfficeMockObject(testObject); + + const range = officeMock.range.load("color"); + await officeMock.sync(); + assert.strictEqual(range.color, "blue"); + }); it("Missing load", async function() { const officeMock = new OfficeMockObject(testObject); assert.strictEqual(officeMock.range.color, "Error, property was not loaded");