-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor API into new
api
package (#3543)
* Add API package * Continue refactoring * Continue refactoring * Fix tests * Fix DLSpeech * Fix speech support * Fix tests * Fix ESLint * Fix tests * Fix ESLint * Fix all TODOs * Add back localize * Clean up * Add entry * Apply suggestions from code review Co-authored-by: Corina <[email protected]> * Apply PR suggestions * Fix tests * Fix tests * Fix tests * Fix tests * Remove eslint-disable Co-authored-by: Corina <[email protected]>
- Loading branch information
Showing
334 changed files
with
10,319 additions
and
2,350 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
Binary file added
BIN
+25.4 KB
...ots__/chrome-docker/adaptive-cards-js-broken-card-of-invalid-version-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+159 KB
__tests__/__image_snapshots__/chrome-docker/upload-js-upload-a-picture-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.09 KB
(120%)
...js-accessibility-requirement-attachments-in-live-region-unknown-card-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.75 KB
...eprecated-localize-js-deprecated-localize-should-localize-text-in-en-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.75 KB
...ze-js-deprecated-localize-should-localize-text-in-navigator-language-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.96 KB
...precated-localize-js-deprecated-localize-should-localize-text-in-yue-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36 KB
...ots__/html/hero-card-actions-js-hero-card-actions-message-back-value-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+78.3 KB
...-render-attachment-js-use-render-attachment-should-render-attachment-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!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 { | ||
WebChat: { | ||
Components: { Composer, Localize } | ||
}, | ||
WebChatTest: { | ||
conditions, | ||
createStore, | ||
expect, | ||
host, | ||
pageObjects, | ||
parseURLParams, | ||
shareObservable, | ||
timeouts, | ||
token: { fetchDirectLineToken }, | ||
updateIn | ||
} | ||
} = window; | ||
|
||
(async function () { | ||
const token = await fetchDirectLineToken(); | ||
const { l: locale } = parseURLParams(window.location.hash); | ||
|
||
await new Promise(resolve => | ||
ReactDOM.render( | ||
<Composer directLine={window.WebChat.createDirectLine({ token })} locale={locale} store={createStore()}> | ||
<Localize text="SPEECH_INPUT_LISTENING" /> | ||
</Composer>, | ||
document.getElementById('webchat'), | ||
resolve | ||
) | ||
); | ||
|
||
await host.snapshot(); | ||
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,9 @@ | ||
/** | ||
* @jest-environment ./__tests__/html/__jest__/WebChatEnvironment.js | ||
*/ | ||
|
||
describe('deprecated <Localize>', () => { | ||
test('should localize text in navigator language', () => runHTMLTest('deprecated.localize.html')); | ||
test('should localize text in "en"', () => runHTMLTest('deprecated.localize.html#l=en')); | ||
test('should localize text in "yue"', () => runHTMLTest('deprecated.localize.html#l=yue')); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!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 { | ||
ReactDOM: { render }, | ||
WebChat: { | ||
Components: { Composer }, | ||
hooks: { useActivities, useRenderAttachment } | ||
}, | ||
WebChatTest: { conditions, createDirectLineWithTranscript, createStore, host, pageObjects, timeouts, token } | ||
} = window; | ||
|
||
(async function () { | ||
const Test = () => { | ||
const [[activity]] = useActivities(); | ||
const renderAttachment = useRenderAttachment(); | ||
|
||
if (!activity) { | ||
return false; | ||
} | ||
|
||
const attachment = renderAttachment({ activity, attachment: activity.attachments[0] }); | ||
|
||
return ( | ||
<React.Fragment> | ||
{attachment} | ||
{!!attachment && <div className="done" />} | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
const directLine = await createDirectLineWithTranscript([ | ||
{ | ||
attachments: [ | ||
{ | ||
contentType: 'image/png', | ||
contentUrl: | ||
'https://raw.githubusercontent.com/compulim/BotFramework-MockBot/master/public/assets/surface1.jpg' | ||
} | ||
], | ||
from: { role: 'bot' }, | ||
id: '1.0', | ||
text: 'Nostrud in dolor Lorem nulla esse anim nisi adipisicing do nisi.', | ||
timestamp: 0, | ||
type: 'message' | ||
} | ||
]); | ||
|
||
const store = createStore(); | ||
|
||
render( | ||
<Composer directLine={directLine} store={store}> | ||
<Test /> | ||
</Composer>, | ||
document.getElementById('webchat') | ||
); | ||
|
||
await pageObjects.wait(conditions.uiConnected(), timeouts.directLine); | ||
await pageObjects.wait(() => document.querySelector('.done'), timeouts.ui); | ||
await pageObjects.wait(conditions.allImagesLoaded(), timeouts.ui); | ||
|
||
await host.snapshot(); | ||
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('useRenderAttachment', () => { | ||
test('should render attachment', () => runHTMLTest('hooks.useRenderAttachment.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
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
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.