-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forced the back links on the draft and template pages to point back t…
…o their respective indexes
- Loading branch information
Showing
7 changed files
with
25 additions
and
16 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
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
14 changes: 6 additions & 8 deletions
14
src/templates/EmailEditorSidebar/__tests__/BackLink.test.tsx
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,17 +1,15 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import userEvent from '@testing-library/user-event' | ||
import { navigate } from 'gatsby' | ||
import { BackLink } from '../BackLink' | ||
import { faker } from '@faker-js/faker' | ||
import { urlFor } from 'src/testHelpers' | ||
|
||
describe('BackLink', () => { | ||
it('is a link that goes back when clicked', async () => { | ||
const user = userEvent.setup() | ||
const { baseElement } = render(<BackLink />) | ||
const link = baseElement.querySelector('a') | ||
const path = `/${faker.lorem.word()}` | ||
const { baseElement } = render(<BackLink to={path} />) | ||
const link: HTMLAnchorElement = baseElement.querySelector('a') as any | ||
expect(link).toHaveTextContent('Back') | ||
expect(navigate).not.toHaveBeenCalled() | ||
await user.click(link!) | ||
expect(navigate).toHaveBeenCalledWith(-1) | ||
expect(link.href).toEqual(urlFor(path)) | ||
}) | ||
}) |
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