Skip to content

Commit

Permalink
Merge branch 'master' into ian/289-staging-env-config
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed Jan 11, 2021
2 parents 4ae2900 + ca03f50 commit 6f7c139
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ const SectionNavigation: React.FC<NavigationProps> = ({
) : (
<Link
to={`${urlBase}/${activeSection + 1}`}
onClick={(e) => {
e.preventDefault();
onClick={() => {
setActiveSection(activeSection + 1);
}}
aria-label="next section"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

import { fireEvent, screen, waitFor, within } from "@testing-library/react";
import { fireEvent, screen, within } from "@testing-library/react";
import mockContentFixture from "./__fixtures__/contentSource";
import { SystemNarrativeContent } from "../contentApi/types";
import { renderNavigableApp } from "../testUtils";
Expand All @@ -41,9 +41,9 @@ test("renders all the sections", () => {
});
});

test("navigation", async () => {
renderNavigableApp({
route: "/us_nd/collections/parole",
test("navigation", () => {
const { history } = renderNavigableApp({
route: "/us-nd/collections/parole",
});

const nextLabel = "next section";
Expand All @@ -63,9 +63,8 @@ test("navigation", async () => {

// advance to section 2
fireEvent.click(nextLink);
await waitFor(() => {
expect(within(navRegion).getByText("02")).toBeInTheDocument();
});
expect(within(navRegion).getByText("02")).toBeInTheDocument();
expect(history.location.pathname).toBe("/us-nd/collections/parole/2");

const prevLink = screen.getByRole("link", { name: prevLabel });
expect(prevLink).toBeInTheDocument();
Expand All @@ -78,13 +77,15 @@ test("navigation", async () => {
within(navRegion).getAllByText(`0${narrativeContent.sections.length + 1}`)
.length
).toBe(2);
expect(history.location.pathname).toBe(
`/us-nd/collections/parole/${narrativeContent.sections.length + 1}`
);

// no next on the last section
expect(nextLink).not.toBeInTheDocument();

// Jest/JSDOM don't support layout features
// JSDOM don't support layout features
// so we can't really test anything related to scroll position :(
// (this also includes URL management because of how the page works)
});

test("renders link tags in copy", async () => {
Expand Down

0 comments on commit 6f7c139

Please sign in to comment.