Skip to content

Commit

Permalink
Export all hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Nov 26, 2019
1 parent 3972dab commit 7722851
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
39 changes: 23 additions & 16 deletions __tests__/hooks/useMicrophoneButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,27 @@ import uiConnected from '../setup/conditions/uiConnected';
jest.setTimeout(timeouts.test);

test('microphoneButtonClick should toggle recording', async () => {
// TODO: [P1] Test is temporarily disabled until the hook is implemented
// const { driver, pageObjects } = await setupWebDriver({
// props: {
// webSpeechPonyfillFactory: () => window.WebSpeechMock
// }
// });
// await driver.wait(uiConnected(), timeouts.directLine);
// await pageObjects.runHook('useMicrophoneButtonClick', [], microphoneButtonClick => microphoneButtonClick());
// await driver.wait(speechRecognitionStartCalled(), timeouts.ui);
// await expect(
// pageObjects.runHook('useMicrophoneButtonDisabled', [], microphoneButtonDisabled => microphoneButtonDisabled[0])
// ).resolves.toBeTruthy();
// await pageObjects.putSpeechRecognitionResult('recognizing', 'Hello');
// await expect(pageObjects.isDictating()).resolves.toBeTruthy();
// await pageObjects.runHook('useMicrophoneButtonClick', [], microphoneButtonClick => microphoneButtonClick());
// await expect(pageObjects.isDictating()).resolves.toBeFalsy();
const { driver, pageObjects } = await setupWebDriver({
props: {
webSpeechPonyfillFactory: () => window.WebSpeechMock
}
});

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.runHook('useMicrophoneButtonClick', [], microphoneButtonClick => microphoneButtonClick());

await driver.wait(speechRecognitionStartCalled(), timeouts.ui);

await expect(
pageObjects.runHook('useMicrophoneButtonDisabled', [], microphoneButtonDisabled => microphoneButtonDisabled[0])
).resolves.toBeTruthy();

await pageObjects.putSpeechRecognitionResult('recognizing', 'Hello');

await expect(pageObjects.isDictating()).resolves.toBeTruthy();

await pageObjects.runHook('useMicrophoneButtonClick', [], microphoneButtonClick => microphoneButtonClick());

await expect(pageObjects.isDictating()).resolves.toBeFalsy();
});
1 change: 0 additions & 1 deletion packages/component/src/SendBox/MicrophoneButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ const useMicrophoneButtonClick = () => {
]);
};

// TODO: [P1] We temporarily not exporting this hook because it requires legacy HOC code
function useMicrophoneButtonDisabled() {
const [dictateState] = useDictateState();
const [disabled] = useDisabled();
Expand Down

0 comments on commit 7722851

Please sign in to comment.