Skip to content

Commit

Permalink
Merge pull request #540 from NYPL/development
Browse files Browse the repository at this point in the history
SFR-2254: Release 0.18.4 to production
  • Loading branch information
jackiequach authored Oct 17, 2024
2 parents 42064aa + 001e363 commit 852ed4b
Show file tree
Hide file tree
Showing 34 changed files with 245 additions and 123 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGE LOG

## [0.18.4]

- Update license link for editions, works, and collections to copyright
- Update License page to Copyright and add section for "In Copyright" explanation
- Remove error codes from error page
- Update styling for mobile view of error page
- SFR:2257 - fix pw tests for modified license page

## [0.18.3]

- Fix error when collections are empty
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sfr-bookfinder-front-end",
"version": "0.18.3",
"version": "0.18.4",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Feature: License Page

Scenario: As a user I want to verify the headers and subheaders of DRB License Page
Given I go to the "license" page
Then the "license explanations header" should be displayed
Scenario: As a user I want to verify the headers and subheaders of DRB Copyright Page
Given I go to the "copyright" page
Then the "copyright explanations header" should be displayed
Then the "public domain header" should be displayed
Then the "public domain us only header" should be displayed
Then the "creative commons licenses header" should be displayed

Scenario: As a user I verify the subheaders of DRB License Page are displayed correctly
Given I go to the "license" page
Scenario: As a user I verify the subheaders of DRB Copyright Page are displayed correctly
Given I go to the "copyright" page
Then the "public domain subheader" should be displayed
Then the "public domain us only subheader" should be displayed
20 changes: 10 additions & 10 deletions playwright/features/drbFooters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Feature: Footer Links
And the "language footer link" should be displayed

Examples:
| DRB |
| "home" |
| "advanced search" |
| "search results" |
| "item details" |
| "edition details" |
| "collection" |
| "read online" |
| "license" |
| "about" |
| DRB |
| "home" |
| "advanced search" |
| "search results" |
| "item details" |
| "edition details" |
| "collection" |
| "read online" |
| "copyright" |
| "about" |
2 changes: 1 addition & 1 deletion playwright/features/headerLinks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Feature: Header Links
| "edition details" |
| "collection" |
| "read online" |
| "license" |
| "copyright" |
| "about" |

Scenario: As a user I navigate to the Digital Research Books home page and verify the account and search header sub-links and elements are displayed
Expand Down
8 changes: 4 additions & 4 deletions playwright/support/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const pages: { [name: string]: Pages } = {
about: {
route: "/about",
},
license: {
route: "/license",
copyright: {
route: "/copyright",
},
"read online": {
route: "/read/4440666",
Expand Down Expand Up @@ -117,7 +117,7 @@ export const elements = {
"item featured edition year": "a:has-text('Edition') >> nth=0",
"item featured edition publisher": "div:text('Published by') >> nth=0",
"item featured edition language": "div:text('Languages') >> nth=0",
"item featured edition license": "[href='/license'] >> nth=0",
"item featured edition license": "[href='/copyright'] >> nth=0",
"item details heading": "#details-list-heading",
"item details authors heading": "dt:text('Authors')",
"item details authors": "dd > a[href*='display=author'] >> nth=0",
Expand Down Expand Up @@ -213,7 +213,7 @@ export const elements = {
"language footer link": "//a[@href='http://www.nypl.org/language']",

/** license page locators */
"license explanations header": "//h1[text()='License Explanations']",
"copyright explanations header": "//h1[text()='Copyright Explanations']",
"public domain header": "//h2[text()='Public Domain']",
"creative commons licenses header":
"//h2[text()='Creative Commons Licenses']",
Expand Down
12 changes: 6 additions & 6 deletions src/__tests__/Search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ describe("Renders Search Results Page", () => {
});
test("Shows license with links", () => {
expect(
screen.getByText("License: Public Domain").closest("a").href
).toContain("/license");
screen.getByText("Copyright: Public Domain").closest("a").href
).toContain("/copyright");
});
test("Shows cover", () => {
expect(
Expand Down Expand Up @@ -415,8 +415,8 @@ describe("Renders Search Results Page", () => {
});
test("Shows Unknown license with links", () => {
expect(
screen.getByText("License: Unknown").closest("a").href
).toContain("/license");
screen.getByText("Copyright: Unknown").closest("a").href
).toContain("/copyright");
});
test("Shows Placeholder cover", () => {
expect(
Expand Down Expand Up @@ -483,10 +483,10 @@ describe("Renders Search Results Page", () => {
expect(
screen
.getByText(
"License: Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain"
"Copyright: Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain"
)
.closest("a").href
).toContain("/license");
).toContain("/copyright");
});
test("Shows cover", () => {
expect(
Expand Down
6 changes: 3 additions & 3 deletions src/components/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ const About: React.FC = () => {
All the materials in Digital Research Books Beta are completely free to
read and most of them you can download and keep, with no library card
required. The books are either in the{" "}
<Link to="/license">public domain</Link>, with no restrictions on your
<Link to="/copyright">public domain</Link>, with no restrictions on your
use of them, or under{" "}
<Link to="/license">Creative Commons licences</Link> that may have some
conditions, but only on redistribution or adaptation.
<Link to="/copyright">Creative Commons licences</Link> that may have
some conditions, but only on redistribution or adaptation.
</p>

<p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/About/__snapshots__/About.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ exports[`renders about unchanged 1`] = `
<a
class="chakra-link css-qsaw8"
href="/license"
href="/copyright"
>
public domain
</a>
, with no restrictions on your use of them, or under
<a
class="chakra-link css-qsaw8"
href="/license"
href="/copyright"
>
Creative Commons licences
</a>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Collection/Collection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ describe("Renders Collection Page", () => {
});
test("Shows license with links", () => {
expect(
screen.getByText("License: Public Domain").closest("a").href
).toContain("/license");
screen.getByText("Copyright: Public Domain").closest("a").href
).toContain("/copyright");
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/CollectionItemCard/CollectionItemCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe("Collection Item Card", () => {
);
});
test("shows license", () => {
expect(screen.getByText("License: Unknown").closest("a").href).toContain(
"/license"
expect(screen.getByText("Copyright: Unknown").closest("a").href).toContain(
"/copyright"
);
});
});
4 changes: 2 additions & 2 deletions src/components/CollectionItemCard/CollectionItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CollectionUtils from "~/src/util/CollectionUtils";
import Ctas from "~/src/components/CollectionItemCard/Ctas";
import EditionYear from "~/src/components/CollectionItemCard/EditionYear";
import PublisherAndLocation from "~/src/components/CollectionItemCard/PublisherAndLocation";
import LicenseLink from "~/src/components/CollectionItemCard/LicenseLink";
import CopyrightLink from "~/src/components/CollectionItemCard/CopyrightLink";
import LanguageDisplayText from "~/src/components/CollectionItemCard/LanguageDisplayText";

// Creates an Collection item card out of the collectionItem object
Expand Down Expand Up @@ -56,7 +56,7 @@ export const CollectionItemCard: React.FC<{
publisher={publisher}
/>
<LanguageDisplayText language={language} />
<LicenseLink rights={rights} />
<CopyrightLink rights={rights} />
</CardContent>
<CardActions display="flex" flexDir="column" whiteSpace="nowrap" gap={4}>
<Ctas
Expand Down
13 changes: 13 additions & 0 deletions src/components/CollectionItemCard/CopyrightLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import { Rights } from "~/src/types/DataModel";
import Link from "~/src/components/Link/Link";

const CopyrightLink: React.FC<{ rights: Rights }> = ({ rights }) => {
return (
<Link to="/copyright">
{rights ? `Copyright: ${rights.rightsStatement}` : "Copyright: Unknown"}
</Link>
);
};

export default CopyrightLink;
13 changes: 0 additions & 13 deletions src/components/CollectionItemCard/LicenseLink.tsx

This file was deleted.

77 changes: 77 additions & 0 deletions src/components/Copyright/Copyright.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from "react";
import { render } from "~/src/__tests__/testUtils/render";
import { screen } from "@testing-library/react";
import Copyright from "./Copyright";

it("renders Copyright page unchanged", async () => {
const tree = render(<Copyright />);
expect(tree.container.firstChild).toMatchSnapshot();
});

describe("Copyright Page", () => {
beforeEach(() => {
render(<Copyright />);
});

it("renders the Copyright Explanations heading", () => {
expect(
screen.getByRole("heading", { name: "Copyright Explanations" })
).toBeInTheDocument();
});

it("renders the Public Domain headings", () => {
expect(
screen.getByRole("heading", { name: "Public Domain" })
).toBeInTheDocument();
expect(
screen.getByRole("heading", { name: "Public Domain (US Only)" })
).toBeInTheDocument();
});

it("renders the Creative Commons section", () => {
expect(
screen.getByRole("heading", { name: "Creative Commons Licenses" })
).toBeInTheDocument();

expect(
screen.getByRole("link", { name: "Creative Commons licenses" })
).toHaveAttribute("href", "https://creativecommons.org/");

expect(
screen.getByRole("link", { name: "Attribution 3.0 Unported (CC BY 3.0)" })
).toHaveAttribute("href", "https://creativecommons.org/licenses/by/3.0/");
});

it("renders the CC0 section", () => {
expect(
screen.getByRole("heading", { name: "CC0 Public Domain Dedication" })
).toBeInTheDocument();

expect(
screen.getByRole("link", {
name: "CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
})
).toHaveAttribute(
"href",
"https://creativecommons.org/publicdomain/zero/1.0/"
);
});

it("renders the GNU section", () => {
expect(
screen.getByRole("heading", { name: "GNU General Public License" })
).toBeInTheDocument();

expect(
screen.getByRole("link", {
name: "GNU General Public License",
})
).toHaveAttribute("href", "http://www.gnu.org/licenses/gpl.html");
});

it("renders the In Copyright heading", () => {
expect(
screen.getByRole("heading", { name: "In Copyright" })
).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {
import Link from "../Link/Link";
import DrbBreakout from "../DrbBreakout/DrbBreakout";

const License: React.FC = () => {
const Copyright: React.FC = () => {
const breakoutElement = (
<DrbBreakout breadcrumbsData={[{ url: "/license", text: "License" }]} />
<DrbBreakout breadcrumbsData={[{ url: "/copyright", text: "Copyright" }]} />
);
const contentPrimaryElement = (
<>
<Heading level="h1">License Explanations</Heading>
<Heading level="h1">Copyright Explanations</Heading>
<Heading level="h2">Public Domain</Heading>
<p>
Works in the public domain have no copyright (in most cases because the
Expand Down Expand Up @@ -159,6 +159,13 @@ const License: React.FC = () => {
, you may copy, distribute and modify the work as long as any
modifications are also made available under the GPL.
</p>
<Heading level="h2">In Copyright</Heading>
<p>
Works that are In Copyright are protected by copyright and/or related
rights. You are free to use this Item in any way that is permitted by
the copyright and related rights legislation that applies to your use.
For other uses you need to obtain permission from the rights-holder(s).
</p>
</>
);
return (
Expand All @@ -169,4 +176,4 @@ const License: React.FC = () => {
);
};

export default License;
export default Copyright;
Loading

0 comments on commit 852ed4b

Please sign in to comment.