-
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.
* CDPT- 1855: Update docs - Bring docs up to date - Add the beginnings of automated testing with test-runner.js - Add last reviewed block * nl * nl * - Update Setup instructions - Add required node version - Fix link
- Loading branch information
1 parent
c133c68
commit 8d5cefb
Showing
24 changed files
with
6,854 additions
and
4,250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { injectAxe, checkA11y } from 'axe-playwright'; | ||
|
||
/* | ||
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api | ||
* to learn more about the test-runner hooks API. | ||
*/ | ||
const config = { | ||
async preVisit(page) { | ||
await injectAxe(page); | ||
}, | ||
async postVisit(page) { | ||
await checkA11y(page, '#storybook-root', { | ||
detailedReport: true, | ||
detailedReportOptions: { | ||
html: true, | ||
}, | ||
}); | ||
}, | ||
tags: { | ||
exclude: ['no-tests'], | ||
}, | ||
}; | ||
|
||
export default config; |
40 changes: 40 additions & 0 deletions
40
public/app/frontend/.storybook/utils/documentation/review-block.js
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,40 @@ | ||
// Helper functions for use in Storybook documentation | ||
const reviewPeriod = 6; | ||
const formatOptions = { | ||
year: "numeric", | ||
month: "long", | ||
day: "numeric", | ||
}; | ||
|
||
/** | ||
* Formats a date string in 'j l, F Y' format | ||
* @param {string} lastReview The date that a page was last reviewed. | ||
* @return {string} The date string formatted as | ||
*/ | ||
function getLastReview(lastReview) | ||
{ | ||
const date = new Date(lastReview); | ||
return date.toLocaleString('en-GB', formatOptions); | ||
} | ||
|
||
/** | ||
* Adds the review period to a date string and returns the date in 'jS l, F Y' format | ||
* @param {string} lastReview The date that a page was last reviewed. | ||
* @return {string} The date string formatted as | ||
*/ | ||
function getNextReview(lastReview) | ||
{ | ||
const date = new Date(lastReview); | ||
const reviewDate = new Date(date.setMonth(date.getMonth() + reviewPeriod)); | ||
return reviewDate.toLocaleString('en-GB', formatOptions); | ||
} | ||
|
||
/** | ||
* Returns a block that displays the last date that a page was reviewed and when it is due a review again | ||
* @param {string} lastReview The date that a page was last reviewed. | ||
* @return {string} The date string formatted as | ||
*/ | ||
export function getReviewBlock(lastReview) | ||
{ | ||
return `This page was last reviewed on ${getLastReview(lastReview)}. It should be reviewed again on ${getNextReview(lastReview)}`; | ||
} |
Oops, something went wrong.