-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware/dfuWindowsDriverInstallDialog: move instructions in app
This replaces the link for Windows DFU USB driver installation instructions with a new in-app dialog containing the instructions. Fixes: pybricks/support#858
- Loading branch information
Showing
16 changed files
with
654 additions
and
40 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
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
43 changes: 43 additions & 0 deletions
43
src/firmware/dfuWindowsDriverInstallDialog/DfuWindowsDriverInstallDialog.test.tsx
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,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2022 The Pybricks Authors | ||
|
||
import { cleanup } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { testRender } from '../../../test'; | ||
import DfuWindowsDriverInstallDialog from './DfuWindowsDriverInstallDialog'; | ||
import { firmwareDfuWindowsDriverInstallDialogDialogHide } from './actions'; | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
jest.resetAllMocks(); | ||
localStorage.clear(); | ||
sessionStorage.clear(); | ||
}); | ||
|
||
it('should dispatch action when the close button is pressed', async () => { | ||
const [user, dialog, dispatch] = testRender(<DfuWindowsDriverInstallDialog />, { | ||
firmware: { dfuWindowsDriverInstallDialog: { isOpen: true } }, | ||
}); | ||
|
||
await user.click(dialog.getByRole('button', { name: 'Close' })); | ||
|
||
expect(dispatch).toHaveBeenCalledWith( | ||
firmwareDfuWindowsDriverInstallDialogDialogHide(), | ||
); | ||
}); | ||
|
||
it('should navigate when next button is pressed and dispatch action when the done button is pressed', async () => { | ||
const [user, dialog, dispatch] = testRender(<DfuWindowsDriverInstallDialog />, { | ||
firmware: { dfuWindowsDriverInstallDialog: { isOpen: true } }, | ||
}); | ||
|
||
for (let i = 1; i < 9; i++) { | ||
await user.click(dialog.getByRole('button', { name: 'Next' })); | ||
} | ||
|
||
await user.click(dialog.getByRole('button', { name: 'Done' })); | ||
|
||
expect(dispatch).toHaveBeenCalledWith( | ||
firmwareDfuWindowsDriverInstallDialogDialogHide(), | ||
); | ||
}); |
Oops, something went wrong.