Skip to content
Open
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
1 change: 1 addition & 0 deletions apps/desktop/src/features/score/ScoreView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export function ScoreView({ song, projectId, onSongUpdate }: ScoreViewProps) {
size="icon"
onClick={projectId ? () => void handleRemove(projectId, attachment) : undefined}
disabled={!projectId}
title={`${t("scoreRemove")}: ${attachment.fileName}`}
aria-label={`${t("scoreRemove")}: ${attachment.fileName}`}
className="size-10 border-rose-300/25 text-rose-200 hover:bg-rose-400/10"
>
Expand Down
8 changes: 4 additions & 4 deletions apps/desktop/src/features/score/ScoreViewer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ describe("ScoreViewer", () => {
expect(page.render).toHaveBeenCalled();
});
expect(page.getViewport).toHaveBeenCalledWith({ scale: 1 });
expect(screen.getByRole("button", { name: "Previous page" })).toBeDisabled();
expect(screen.getByRole("button", { name: "Next page" })).toBeEnabled();
expect(screen.getByRole("button", { name: "Previous page" })).toHaveAttribute("aria-disabled", "true");
expect(screen.getByRole("button", { name: "Next page" })).toHaveAttribute("aria-disabled", "false");
});

it("shows the file name when provided", async () => {
Expand Down Expand Up @@ -174,14 +174,14 @@ describe("ScoreViewer", () => {
expect(await screen.findByText("Page 1 of 3")).toBeInTheDocument();
const previousButton = screen.getByRole("button", { name: "Previous page" });
const nextButton = screen.getByRole("button", { name: "Next page" });
expect(previousButton).toBeDisabled();
expect(previousButton).toHaveAttribute("aria-disabled", "true");

fireEvent.click(nextButton);
expect(screen.getByText("Page 2 of 3")).toBeInTheDocument();

fireEvent.click(nextButton);
expect(screen.getByText("Page 3 of 3")).toBeInTheDocument();
expect(nextButton).toBeDisabled();
expect(nextButton).toHaveAttribute("aria-disabled", "true");

await waitFor(() => {
expect(doc.getPage).toHaveBeenCalledWith(3);
Expand Down
14 changes: 10 additions & 4 deletions apps/desktop/src/features/score/ScoreViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export function ScoreViewer({ data, fileName, onStatusChange }: ScoreViewerProps
variant="outline"
size="icon-lg"
className="size-12"
title={t("scoreViewerZoomOut")}
aria-label={t("scoreViewerZoomOut")}
onClick={zoomOut}
>
Expand All @@ -266,6 +267,7 @@ export function ScoreViewer({ data, fileName, onStatusChange }: ScoreViewerProps
variant="outline"
size="icon-lg"
className="size-12"
title={t("scoreViewerZoomIn")}
aria-label={t("scoreViewerZoomIn")}
onClick={zoomIn}
>
Expand All @@ -291,9 +293,11 @@ export function ScoreViewer({ data, fileName, onStatusChange }: ScoreViewerProps
variant="outline"
size="icon-lg"
className="size-14"
title={t("scoreViewerPrevPage")}
aria-label={t("scoreViewerPrevPage")}
disabled={pageNumber <= 1}
onClick={goToPreviousPage}
aria-disabled={pageNumber <= 1}
tabIndex={0}
onClick={pageNumber <= 1 ? undefined : goToPreviousPage}
>
<ChevronLeft className="size-6" aria-hidden="true" />
</Button>
Expand All @@ -304,9 +308,11 @@ export function ScoreViewer({ data, fileName, onStatusChange }: ScoreViewerProps
variant="outline"
size="icon-lg"
className="size-14"
title={t("scoreViewerNextPage")}
aria-label={t("scoreViewerNextPage")}
disabled={pageNumber >= pageCount}
onClick={goToNextPage}
aria-disabled={pageNumber >= pageCount}
tabIndex={0}
onClick={pageNumber >= pageCount ? undefined : goToNextPage}
>
<ChevronRight className="size-6" aria-hidden="true" />
</Button>
Expand Down
Loading