feat: enable downloads from search results
This commit is contained in:
1 parent
cccb214229
commit
9aa79cbce9
3 files changed
+53
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
|
||||
import { afterEach, expect, test } from "vitest";
|
||||
|
||||
import { AlbumContactSheet } from "./catalog-content";
|
||||
@@ -83,6 +83,25 @@ test("renders the server-scoped download choices for a catalog photo", () => {
|
||||
expect(screen.getByRole("button", { name: /original laden/i })).not.toBeNull();
|
||||
});
|
||||
|
||||
test("offers the existing download workflow on a global search result and its lightbox", () => {
|
||||
render(
|
||||
<PhotoGallery
|
||||
albumName="Alle Alben"
|
||||
downloadOptions={{ priceCents: 100, priorUsagesByAsset: {} }}
|
||||
items={[{
|
||||
...photo,
|
||||
id: "22222222-2222-4222-8222-222222222222",
|
||||
albums: [{ id: "33333333-3333-4333-8333-333333333333" }],
|
||||
}]}
|
||||
showAlbumName
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByRole("button", { name: /original laden/i })).not.toBeNull();
|
||||
fireEvent.click(screen.getByRole("button", { name: /tor-des-sieges\.jpg vergrößern/i }));
|
||||
expect(within(screen.getByRole("dialog")).getByRole("button", { name: /original laden/i })).not.toBeNull();
|
||||
});
|
||||
|
||||
test("opens a full-screen lightbox when a photo tile is clicked", () => {
|
||||
render(
|
||||
<PhotoGallery
|
||||
@@ -106,4 +125,4 @@ test("opens a full-screen lightbox when a photo tile is clicked", () => {
|
||||
expect(screen.getByRole("button", { name: /nächstes bild/i })).not.toBeNull();
|
||||
// No previous on the first photo.
|
||||
expect(screen.queryByRole("button", { name: /vorheriges bild/i })).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user