-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate rendering into a testable module
Refs #1700
- Loading branch information
1 parent
be6366c
commit 8733224
Showing
13 changed files
with
89 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { format } from 'fp-ts-routing' | ||
import { getLangDir } from 'rtl-detect' | ||
import { html, plainText } from '../../html' | ||
import type { PreprintTitle } from '../../preprint' | ||
import { StreamlinePageResponse } from '../../response' | ||
import { preprintReviewsMatch, writeReviewStartMatch } from '../../routes' | ||
import { type Form, nextFormMatch } from '../form' | ||
|
||
export const carryOnPage = (preprint: PreprintTitle, form: Form) => | ||
StreamlinePageResponse({ | ||
title: plainText`Write a PREreview`, | ||
nav: html` | ||
<a href="${format(preprintReviewsMatch.formatter, { id: preprint.id })}" class="back">Back to preprint</a> | ||
`, | ||
main: html` | ||
<h1>Write a PREreview</h1> | ||
<p> | ||
As you’ve already started a PREreview of | ||
<cite lang="${preprint.language}" dir="${getLangDir(preprint.language)}">${preprint.title}</cite>, we’ll take | ||
you to the next step so you can carry on. | ||
</p> | ||
<a href="${format(nextFormMatch(form).formatter, { id: preprint.id })}" role="button" draggable="false" | ||
>Continue</a | ||
> | ||
`, | ||
canonical: format(writeReviewStartMatch.formatter, { id: preprint.id }), | ||
}) |
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
3 changes: 3 additions & 0 deletions
3
...c.ts-snapshots/content-looks-right-1-Desktop-Chrome-Visual-Regression-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...content-looks-right-1-Desktop-Chrome-Visual-Regression-no-JavaScript--linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
.../content-looks-right-1-Desktop-Chrome-high-contrast-Visual-Regression-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...right-1-Desktop-Chrome-high-contrast-Visual-Regression-no-JavaScript--linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
....ts-snapshots/content-looks-right-1-Desktop-Firefox-Visual-Regression-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...ontent-looks-right-1-Desktop-Firefox-Visual-Regression-no-JavaScript--linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...s/content-looks-right-1-Mobile-Chrome-high-contrast-Visual-Regression-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...-right-1-Mobile-Chrome-high-contrast-Visual-Regression-no-JavaScript--linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...t.spec.ts-snapshots/content-looks-right-1-iPhone-11-Visual-Regression-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...hots/content-looks-right-1-iPhone-11-Visual-Regression-no-JavaScript--linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { Doi } from 'doi-ts' | ||
import { html } from '../../src/html' | ||
import type { PreprintTitle } from '../../src/preprint' | ||
import type { Form } from '../../src/write-review/form' | ||
import { carryOnPage } from '../../src/write-review/start-page/carry-on-page' | ||
import { expect, test } from '../base' | ||
|
||
test('content looks right', async ({ showPage }) => { | ||
const response = carryOnPage(preprint, form) | ||
|
||
const content = await showPage(response) | ||
|
||
await expect(content).toHaveScreenshot() | ||
}) | ||
|
||
const preprint = { | ||
id: { | ||
type: 'biorxiv', | ||
value: '10.1101/2022.01.13.476201' as Doi<'1101'>, | ||
}, | ||
title: html`The role of LHCBM1 in non-photochemical quenching in <i>Chlamydomonas reinhardtii</i>`, | ||
language: 'en', | ||
} satisfies PreprintTitle | ||
|
||
const form = {} satisfies Form |