Skip to content

Commit 9da963d

Browse files
authored
Migrate legacy hook tests to html2 (#5653)
* Migrate useActivities * Migrate useAdaptiveCardsHostConfig * Migrate useAdaptiveCardsPackage * Migrate useAvatarForBot * Migrate useAvatarForUser * Migrate useByteFormatter * Format * Migrate useConnectivityStatus * Migrate useDateFormatter * Migrate useDictateInterims * Move tests * Migrate useDisabled * Migrate useDismissNotification * Migrate useFocusSendBox * Migrate useGrammars * Migrate useGroupTimestamp * Migrate useLanguage * Migrate useLocalizer * Rename to pure * Move tests * Migrate useMarkActivityAsSpoken * Migrate useMicrophoneButton * Migrate usePerformCardAction * Migrate usePostActivity * Migrate useRelativeTimeFormatter * Migrate useRenderMarkdownAsHTML * Migrate useSendBoxSpeechInterimsVisible * Migrate useSendBoxValue * Migrate useSendFiles * Fix test * Move tests * Migrate useSendMessage * Migrate useSendMessageBack * Migrate useSendPostBack * MIgrate useSetNotification * Migrate useShouldSpeakIncomingActivity * Migrate useStartDictate * Migrate useStopDictate * Migrate useStyleOptions * Migrate useStyleSet * Migrate useSubmitSendBox * Migrate useSuggestedActions * Migrate useTextBoxValue * Migrate useTimeoutForSend * Migrate useTrackDimension * Migrate useTrackEvent * Move tests * Migrate useTrackException * Migrate useUserID * Migrate useUsername * Migrate useVoiceSelector * Migrate useWebSpeechPonyfill * Move tests * Update path of speechPageObjects.js * Add snapshot * Reduce flakiness
1 parent 2577a96 commit 9da963d

222 files changed

Lines changed: 6063 additions & 2178 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { BasicWebChat, Composer } from 'botframework-webchat/component';
2+
import { createElement } from 'react';
3+
import { createRoot } from 'react-dom/client';
4+
5+
function RunFunction({ fn }) {
6+
fn();
7+
8+
return false;
9+
}
10+
11+
export default function createRenderHook(
12+
/** @type {HTMLElement} */
13+
element,
14+
props,
15+
{ renderWebChat } = {}
16+
) {
17+
const root = createRoot(element);
18+
19+
return fn =>
20+
new Promise(resolve =>
21+
root.render(
22+
createElement(
23+
Composer,
24+
props,
25+
...[
26+
...(renderWebChat ? [createElement(BasicWebChat)] : []),
27+
createElement(RunFunction, { fn: () => resolve(fn?.()), key: Date.now() })
28+
]
29+
)
30+
)
31+
);
32+
}
File renamed without changes.

__tests__/html2/speech/js/MockedSpeechSynthesisErrorEvent.js renamed to __tests__/assets/esm/speech/MockedSpeechSynthesisErrorEvent.js

File renamed without changes.

__tests__/html2/speech/js/MockedSpeechSynthesisEvent.js renamed to __tests__/assets/esm/speech/MockedSpeechSynthesisEvent.js

File renamed without changes.

__tests__/html2/speech/js/MockedSpeechSynthesisUtterance.js renamed to __tests__/assets/esm/speech/MockedSpeechSynthesisUtterance.js

File renamed without changes.

__tests__/html2/speech/js/MockedSpeechSynthesisVoice.js renamed to __tests__/assets/esm/speech/MockedSpeechSynthesisVoice.js

File renamed without changes.
File renamed without changes.

__tests__/hooks/useActivity.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

__tests__/hooks/useAdaptiveCardsHostConfig.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)