Skip to content

Commit

Permalink
Merge pull request #185 from nulib/4548-add-annotation-page-label-iiif
Browse files Browse the repository at this point in the history
Add AnnotationPage label to IIIF response
  • Loading branch information
adamjarling authored Feb 20, 2024
2 parents beb6a47 + 6c20747 commit 133660d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/api/response/iiif/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function transform(response) {
canvas.createAnnotationPage(
`${canvasId}/annotations/page/0`,
(annotationPageBuilder) => {
annotationPageBuilder.addLabel("Chapters", "en");
annotationPageBuilder.createAnnotation(
buildSupplementingAnnotation({ canvasId, fileSet })
);
Expand Down
3 changes: 0 additions & 3 deletions src/api/response/iiif/presentation-api/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ function buildSupplementingAnnotation({ canvasId, fileSet }) {
id: fileSet?.webvtt,
type: "Text",
format: "text/vtt",
label: {
en: ["Chapters"],
},
language: "none",
},
target: canvasId,
Expand Down
6 changes: 6 additions & 0 deletions test/unit/api/response/iiif/manifest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ describe("A/V Work as IIIF Manifest response transformer", () => {
expect(annotation.body.format).to.eq("application/x-mpegurl");
expect(annotation.body.id).to.eq(source.file_sets[0].streaming_url);
});

it("renders a label for AnnotationPage with default value", async () => {
const { manifest } = await setup();
const annotationPageLabel = manifest.items[1].annotations[0].label["en"][0];
expect(annotationPageLabel).to.eq("Chapters");
});
});

describe("404 network response", () => {
Expand Down
1 change: 0 additions & 1 deletion test/unit/api/response/iiif/presentation-api/items.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ describe("IIIF response presentation API items helpers", () => {
expect(annotation.body.id).to.eq(accessImage.webvtt);
expect(annotation.body.type).to.eq("Text");
expect(annotation.body.format).to.eq("text/vtt");
expect(annotation.body.label.en[0]).to.eq("Chapters");
expect(annotation.body.language).to.eq("none");
expect(annotation.target).to.eq(canvasId);
});
Expand Down

0 comments on commit 133660d

Please sign in to comment.