AccessSecretStorageDialog: various fixes (#30093)
* AccessSecretStorageDialog: clear notice when input is empty * AccessSecretStorageDialog: Simplify logic for calculating feedback No functional changes, just simplification * AccessSecretStorageDialog: use the right icon Should be a ! in a circle, not an X. Also requires use of `Flex` to fix the vertical alignment. * AccessSecretStorageDialog: fix resizing when key is correct * AccessSecretStorageDialog: remove confirmation on dialog close Per discussion on https://github.com/element-hq/element-web/issues/30024, we don't want this any more.
This commit is contained in:
committed by
GitHub
parent
073606207e
commit
3e8599bba0
@@ -29,15 +29,15 @@ describe("AccessSecretStorageDialog", () => {
|
||||
render(<AccessSecretStorageDialog {...defaultProps} {...props} />);
|
||||
};
|
||||
|
||||
const enterRecoveryKey = (): void => {
|
||||
act(() => {
|
||||
const enterRecoveryKey = async (valueToEnter: string = recoveryKey): Promise<void> => {
|
||||
await act(async () => {
|
||||
fireEvent.change(screen.getByRole("textbox"), {
|
||||
target: {
|
||||
value: recoveryKey,
|
||||
value: valueToEnter,
|
||||
},
|
||||
});
|
||||
// wait for debounce
|
||||
jest.advanceTimersByTime(250);
|
||||
// wait for debounce, and then give `checkPrivateKey` a chance to complete
|
||||
await jest.advanceTimersByTimeAsync(250);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -116,4 +116,22 @@ describe("AccessSecretStorageDialog", () => {
|
||||
await expect(screen.findByText("The recovery key you entered is not correct.")).resolves.toBeInTheDocument();
|
||||
expect(screen.getByText("Continue")).toHaveAttribute("aria-disabled", "true");
|
||||
});
|
||||
|
||||
it("Clears the 'invalid recovery key' notice when the input is cleared", async function () {
|
||||
renderComponent({ onFinished: () => {}, checkPrivateKey: () => false });
|
||||
|
||||
jest.spyOn(mockClient.secretStorage, "checkKey").mockRejectedValue(new Error("invalid key"));
|
||||
|
||||
// First, enter the wrong recovery key
|
||||
await enterRecoveryKey();
|
||||
expect(screen.getByText("The recovery key you entered is not correct.")).toBeInTheDocument();
|
||||
|
||||
// Now, clear the input: the notice should be cleared.
|
||||
await enterRecoveryKey("");
|
||||
expect(screen.queryByText("The recovery key you entered is not correct.")).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("If you have a security key or security phrase, this will work too."),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("Continue")).toHaveAttribute("aria-disabled", "true");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user