diff --git a/src/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.tsx b/src/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.tsx index e33326e0e37..dfdbfdb4042 100644 --- a/src/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.tsx +++ b/src/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.tsx @@ -40,16 +40,6 @@ export class PromptChooseDeviceStep extends React.Component< } public render(): JSX.Element { - const onNextButton = () => { - // To be implemented in future feature work - console.log(`androidSetupActionCreator.next()`); - }; - - const onRescanButton = () => { - // To be implemented in future feature work - console.log(`androidSetupActionCreator.rescan()`); - }; - // Available devices will be retrieved from store in future feature work const devices: DeviceInfo[] = [ { @@ -76,7 +66,11 @@ export class PromptChooseDeviceStep extends React.Component< children: ( <>

{devices.length} Android devices or emulators connected

- + this.props.deps.androidSetupActionCreator.next(), }, }; diff --git a/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/__snapshots__/prompt-choose-device-step.test.tsx.snap b/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/__snapshots__/prompt-choose-device-step.test.tsx.snap index 0baee8e360f..2659656babd 100644 --- a/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/__snapshots__/prompt-choose-device-step.test.tsx.snap +++ b/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/__snapshots__/prompt-choose-device-step.test.tsx.snap @@ -23,6 +23,7 @@ exports[`PromptChooseDeviceStep renders per snapshot 1`] = ` Android devices or emulators connected

diff --git a/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.test.tsx b/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.test.tsx index 54fd04524bd..a0f8f08f019 100644 --- a/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.test.tsx +++ b/src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.test.tsx @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import { AndroidSetupActionCreator } from 'electron/flux/action-creator/android-setup-action-creator'; import { AndroidSetupStepLayout } from 'electron/views/device-connect-view/components/android-setup/android-setup-step-layout'; import { CommonAndroidSetupStepProps } from 'electron/views/device-connect-view/components/android-setup/android-setup-types'; import { PromptChooseDeviceStep } from 'electron/views/device-connect-view/components/android-setup/prompt-choose-device-step'; @@ -11,11 +12,14 @@ import { IMock, Mock, Times } from 'typemoq'; describe('PromptChooseDeviceStep', () => { let props: CommonAndroidSetupStepProps; let closeAppMock: IMock; + let actionMessageCreatorMock: IMock; beforeEach(() => { closeAppMock = Mock.ofInstance(() => {}); + actionMessageCreatorMock = Mock.ofType(AndroidSetupActionCreator); props = new AndroidSetupStepPropsBuilder('prompt-choose-device') .withDep('closeApp', closeAppMock.object) + .withDep('androidSetupActionCreator', actionMessageCreatorMock.object) .build(); }); @@ -31,6 +35,20 @@ describe('PromptChooseDeviceStep', () => { closeAppMock.verify(m => m(), Times.once()); }); + it('passes rescan dep through', () => { + const rendered = shallow(); + const rescanButton = rendered.find({ 'data-automation-id': 'rescan' }); + rescanButton.simulate('click'); + actionMessageCreatorMock.verify(m => m.rescan(), Times.once()); + }); + + it('passes next dep through', () => { + const stubEvent = {} as React.MouseEvent; + const rendered = shallow(); + rendered.find(AndroidSetupStepLayout).prop('rightFooterButtonProps').onClick(stubEvent); + actionMessageCreatorMock.verify(m => m.next(), Times.once()); + }); + it('next button becomes enabled after device is selected', () => { const rendered = mount(); expect(rendered.find('button').at(2).props().disabled).toBeTruthy();