Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ it.each([
await password.fill("wrong");
await screen.getByRole("button", { name: "Unlock" }).click();
await expect.element(screen.getByText("Incorrect password. Try again.")).toBeVisible();
await expect.element(password).toHaveFocus();
await password.fill("open me");
await screen.getByRole("button", { name: "Unlock" }).click();
if (kind === "docx") await expect.element(screen.getByText(content)).toBeVisible();
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/components/files/FilePasswordPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function FilePasswordPrompt(props: {
aria-label={gt("File password")}
aria-describedby={status}
autoComplete="off"
autoFocus={props.incorrect}
required
/>
</div>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/files/PdfViewer.browser.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,12 @@ it("retries an incorrect password and renders the encrypted PDF", async () => {
container.style.cssText = "display:flex;width:500px;height:400px";
await using screen = await render(<PdfViewer src={src} title="Locked PDF" />, { container });
const password = screen.getByLabelText("File password");
await expect.element(password).toBeVisible();
await expect.element(password).not.toHaveFocus();
await password.fill("wrong");
await screen.getByRole("button", { name: "Unlock" }).click();
await expect.element(screen.getByText("Incorrect password. Try again.")).toBeVisible();
await expect.element(password).toHaveFocus();
await password.fill("open me");
await userEvent.keyboard("{Enter}");
await expect.element(screen.getByText("Unlocked PDF")).toBeVisible();
Expand Down
Loading