-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass userID prop to chat adapter setUserId() (#3544)
* default sending user id to DLJS * Bump botframework-directlinejs@0.14.0 * Add CHANGELOG and comments * Bump to botframework-directlinejs@0.14.1 * Add test * Add eslint for test * Call setUserId only if needed Co-authored-by: William Wong <compulim@hotmail.com> Co-authored-by: William Wong <compulim@users.noreply.github.com>
- Loading branch information
1 parent
e274fa9
commit ec6963d
Showing
11 changed files
with
155 additions
and
67 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
globals: | ||
runHTMLTest: readonly | ||
ignorePatterns: | ||
- "**/*.js" | ||
- "!/html/__jest__/*.js" | ||
|
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,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<head> | ||
<script crossorigin="anonymous" src="/__dist__/testharness.js"></script> | ||
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> | ||
</head> | ||
<body> | ||
<div id="webchat"></div> | ||
<script type="text/babel" data-presets="env,stage-3,react"> | ||
const { | ||
WebChatTest: { | ||
conditions, | ||
createDirectLineWithTranscript, | ||
createStore, | ||
expect, | ||
host, | ||
pageObjects, | ||
timeouts, | ||
token | ||
} | ||
} = window; | ||
|
||
(async function () { | ||
let userId; | ||
const directLine = createDirectLineWithTranscript([]); | ||
|
||
directLine.setUserId = nextUserId => { | ||
userId = nextUserId; | ||
}; | ||
|
||
window.WebChat.renderWebChat( | ||
{ | ||
directLine, | ||
store: createStore(), | ||
userID: 'u-12345' | ||
}, | ||
document.getElementById('webchat') | ||
); | ||
|
||
await pageObjects.wait(conditions.uiConnected(), timeouts.directLine); | ||
|
||
expect(userId).toBe('u-12345'); | ||
|
||
await host.done(); | ||
})().catch(async err => { | ||
console.error(err); | ||
|
||
await host.error(err); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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,7 @@ | ||
/** | ||
* @jest-environment ./__tests__/html/__jest__/WebChatEnvironment.js | ||
*/ | ||
|
||
describe('DirectLine', () => { | ||
test('should set user ID if setUserID function is provided', () => runHTMLTest('directLine.setUserId.html')); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.