Skip to content

Commit

Permalink
Make tasks.submitTask backwards compatible and prepare to release v1.…
Browse files Browse the repository at this point in the history
…3.5 of the SDK
  • Loading branch information
ydogandjiev committed Sep 11, 2018
1 parent 32d91f4 commit a622a5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To install the stable version:

#### Production

You can access [these files on unpkg](https://unpkg.com/@microsoft/teams-js@1.3.4/dist/MicrosoftTeams.min.js), download them, or point your package manager to them.
You can access [these files on unpkg](https://unpkg.com/@microsoft/teams-js@1.3.5/dist/MicrosoftTeams.min.js), download them, or point your package manager to them.

## Usage

Expand All @@ -46,10 +46,10 @@ Reference the library inside of your `.html` page using:

```html
<!-- Microsoft Teams JavaScript API (via CDN) -->
<script src="https://unpkg.com/@microsoft/teams-js@1.3.4/dist/MicrosoftTeams.min.js" integrity="sha384-3zTjxw3msc6gKx3DseSU0lfRM129YrFjr2xgocfMIN/kBCdzJ88d+FSB1n3scUku" crossorigin="anonymous"></script>
<script src="https://unpkg.com/@microsoft/teams-js@1.3.5/dist/MicrosoftTeams.min.js" integrity="sha384-t1ID2NmMGB5huCWZdo2EV4RXQ9H/+VDaxxWeUfWuuVuYIc62+Xj7M5re4yqbpbDt" crossorigin="anonymous"></script>

<!-- Microsoft Teams JavaScript API (via npm) -->
<script src="node_modules/@microsoft/teams-js@1.3.4/dist/MicrosoftTeams.min.js"></script>
<script src="node_modules/@microsoft/teams-js@1.3.5/dist/MicrosoftTeams.min.js"></script>

<!-- Microsoft Teams JavaScript API (via local) -->
<script src="MicrosoftTeams.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/teams-js",
"author": "Microsoft Teams",
"version": "1.3.4",
"version": "1.3.5",
"description": "Microsoft Client SDK for building app for Microsoft teams",
"main": "./dist/MicrosoftTeams.min.js",
"typings": "./dist/MicrosoftTeams.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions src/MicrosoftTeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface Window {
namespace microsoftTeams {
"use strict";

const version = "1.3.4";
const version = "1.3.5";

const validOrigins = [
"https://teams.microsoft.com",
Expand Down Expand Up @@ -2110,7 +2110,8 @@ namespace microsoftTeams {
): void {
ensureInitialized(frameContexts.content, frameContexts.task);

sendMessageRequest(parentWindow, "tasks.submitTask", [
// Send tasks.completeTask instead of tasks.submitTask message for backward compatibility with Mobile clients
sendMessageRequest(parentWindow, "tasks.completeTask", [
result,
Array.isArray(appIds) ? appIds : [appIds]
]);
Expand Down
6 changes: 3 additions & 3 deletions test/MicrosoftTeams.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe("MicrosoftTeams", () => {
expect(initMessage.id).toBe(0);
expect(initMessage.func).toBe("initialize");
expect(initMessage.args.length).toEqual(1);
expect(initMessage.args[0]).toEqual("1.3.4");
expect(initMessage.args[0]).toEqual("1.3.5");
});

it("should allow multiple initialize calls", () => {
Expand Down Expand Up @@ -1406,7 +1406,7 @@ describe("MicrosoftTeams", () => {
"someOtherAppId"
]);

const submitTaskMessage = findMessageByFunc("tasks.submitTask");
const submitTaskMessage = findMessageByFunc("tasks.completeTask");
expect(submitTaskMessage).not.toBeNull();
expect(submitTaskMessage.args).toEqual([
"someResult",
Expand All @@ -1419,7 +1419,7 @@ describe("MicrosoftTeams", () => {

microsoftTeams.tasks.submitTask("someResult", "someAppId");

const submitTaskMessage = findMessageByFunc("tasks.submitTask");
const submitTaskMessage = findMessageByFunc("tasks.completeTask");
expect(submitTaskMessage).not.toBeNull();
expect(submitTaskMessage.args).toEqual(["someResult", ["someAppId"]]);
});
Expand Down

0 comments on commit a622a5e

Please sign in to comment.