Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DR-2574 Template for homepage #18

Merged
merged 6 commits into from
Oct 27, 2023
Merged
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: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ The following endpoints are currently available at http://localhost:3000/api/lan
- [/photographs](http://localhost:3000/api/lanes/photographs)
- [/prints-and-drawings](http://localhost:3000/api/lanes/prints-and-drawings)
- [/recently-digitized-collections](http://localhost:3000/api/lanes/recently-digitized-collections)
- [/items](http://localhost:3000/api/lanes/items)

### Individual Lane - GET /api/lanes/[...slug]

Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions __tests__/homepage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ describe("Home", () => {
});
expect(header).toBeInTheDocument();
});

it("renders the expected text content", () => {
const { getByText } = render(<Home />);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best I could come up with for unit tests on components that don't actually have any content, but is there a more thorough way to do this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is okay! We also had a hard time testing this on the DS. The accessibility test covers what we want as well.

expect(getByText("Notification banner")).toBeInTheDocument();
expect(getByText("Header")).toBeInTheDocument();
expect(getByText("First swim lane")).toBeInTheDocument();
expect(getByText("Featured Content")).toBeInTheDocument();
expect(getByText("Rest of swim lanes")).toBeInTheDocument();
expect(getByText("Explore further links")).toBeInTheDocument();
});
});
21 changes: 20 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
import CampaignHero from "../components/hero/campaignHero";
import {
SkipNavigation,
TemplateAppContainer,
} from "@nypl/design-system-react-components";

export default function Home() {
return <CampaignHero />;
return (
<TemplateAppContainer
aboveHeader={<p> Notification banner </p>}
header={<p> Header </p>}
breakout={<CampaignHero />}
contentPrimary={
<>
<p>First swim lane</p>
<p>Featured Content</p>
<p>Rest of swim lanes</p>
<p>Explore further links</p>
</>
}
renderSkipNavigation={true}
/>
);
}