-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set default labels as index + 1 for canvas figures. (#232)
* Set default labels as index + 1 for canvas figures. * Make canvas index relative of original items array.
- Loading branch information
1 parent
b186d99
commit af38478
Showing
4 changed files
with
79 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,53 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
import { Canvas } from "@iiif/presentation-3"; | ||
import Media from "src/components/Viewer/Media/Media"; | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
const items = [ | ||
{ | ||
id: "https://example.org/manifest/1/canvas/1", | ||
type: "Canvas", | ||
height: 600, | ||
width: 800, | ||
label: { none: ["Canvas 1"] }, | ||
thumbnail: [ | ||
{ | ||
id: "https://example.org/item/1/default.jpg", | ||
type: "Image", | ||
height: 75, | ||
width: 100, | ||
format: "image/jpeg", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: "https://example.org/manifest/1/canvas/2", | ||
type: "Canvas", | ||
height: 600, | ||
width: 800, | ||
label: { none: ["Canvas 2"] }, | ||
thumbnail: [ | ||
{ | ||
id: "https://example.org/item/2/default.jpg", | ||
type: "Image", | ||
height: 75, | ||
width: 100, | ||
format: "image/jpeg", | ||
}, | ||
], | ||
}, | ||
] as unknown as Canvas[]; | ||
|
||
describe("Media component", () => { | ||
it("renders", () => { | ||
render(<Media items={[]} activeItem={0} />); | ||
render(<Media items={items} activeItem={0} />); | ||
const media = screen.getByTestId("media"); | ||
expect(media); | ||
expect(media.hasAttribute("aria-label")).toBe(true); | ||
expect(media.getAttribute("data-active-canvas")).toBe( | ||
"https://example.org/manifest/1/canvas/1", | ||
); | ||
expect(media.getAttribute("data-canvas-length")).toBe("2"); | ||
}); | ||
}); |
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