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

Input #8

Merged
merged 36 commits into from Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
de4cce1
Initial input
Dec 16, 2018
b8dfed4
remove todo and eslint fix
Dec 17, 2018
32df3be
Fixes to input html output
Jan 9, 2019
d7b91ee
input template tests
Jan 9, 2019
a51b650
disable snapshot tests
Jan 10, 2019
1607f99
optionsToProps for input and label
Jan 11, 2019
ef1c29d
couple of todo items
Jan 11, 2019
86a7c09
load template tests from govuk-frontend-template-spec
Jan 14, 2019
9b1b547
remove redundant readme todo
Jan 14, 2019
45a9ac4
snapshot required in git for CI to pass
Jan 14, 2019
32a9f81
input sub prop attribute parsing
Jan 14, 2019
d87663f
jest-serializer-html
Jan 14, 2019
5f5eac3
minor prop reorder to match snapshots
Jan 14, 2019
22358d5
jest config change for rootDir
Jan 14, 2019
501e481
remove duplication via setup-tests
Jan 14, 2019
9fb016a
TODO on label
Jan 14, 2019
66476e6
import button and header tests from spec
Jan 14, 2019
802953c
extract stories from govuk-frontend examples
Jan 14, 2019
a42b8d0
allow label, hint and errorMessage to be strings rather than objects
Jan 14, 2019
50404d7
Final form input example in storybook
Jan 14, 2019
28e9eee
readme grey area
Jan 14, 2019
59dad37
allow input label prop to be a string and add unit tests
Jan 16, 2019
61dc9ff
Input Formik example in storybook
Jan 16, 2019
0189bbb
add exports for new components
Jan 16, 2019
e6f9be7
Update README TODO
Jan 16, 2019
774c4a6
Formik storybook actions
Jan 16, 2019
98efd4a
flow types and remove use of dangerouslySetHtml
Jan 18, 2019
19253d8
fix formik fixture labels and error messages
Jan 18, 2019
71d0ee3
fix missing form group classes on input
Jan 18, 2019
7783b9b
make Formik and Final Form examples match
Jan 18, 2019
e0559d7
note on Final Form, Formik and Error Summary in README/TODO
Jan 18, 2019
b6e4a81
add TODO on setRender
Jan 18, 2019
ec73e27
input flow types
Jan 18, 2019
ccd00c3
fixed not using css module class in label
Jan 18, 2019
578c655
remove completed TODO
Jan 18, 2019
b0b0067
fix flow/defaultProps eslint issue
Jan 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions README.md
Expand Up @@ -35,8 +35,11 @@ I aim to complete the following as part of the PoC:
- [x] Button
- [x] Header compatible with React Router
- [x] Support for js-enabled class, used by Header, plus any associated JS required by Header
- [ ] Input [compatible with Final Form](https://medium.com/@penx/form-elements-in-presentational-component-packages-a618e9aa7416)
- [ ] Date Input [compatible with Final Form](https://medium.com/@penx/form-elements-in-presentational-component-packages-a618e9aa7416)
- [x] Input with Final Form and Formik examples.
- [ ] Date Input with Final Form and Formik examples.
- [ ] Radios
- [ ] Tables
- [ ] Error summary with Formik and Final Form examples, following govuk design system guidelines.
- [x] Code coverage checks in CI
- [x] 100% code coverage
- [x] Meaningful unit tests
Expand All @@ -47,3 +50,17 @@ I aim to complete the following as part of the PoC:
- [x] [Next.js example](https://github.com/penx/govuk-frontend-react-example-next)
- [ ] Support for path splitting blocked by [zeit/next-plugins#190](https://github.com/zeit/next-plugins/pull/190) ([related](https://spectrum.chat/next-js/general/dynamic-css-splitting~03351ba8-e4aa-4788-a8ce-2d765b1b1f61?m=MTUzNzE1NDM5ODQ5OQ==))
- [ ] Server side only example with form submit and display of form errors

Other TODO:

- [ ] Script to convert govuk-frontend attributes to prop types (or Flow types)
- [ ] Export standalone templates, CSS includes and CSS modules separately, e.g. `import { Button } from 'govuk-frontend-react'` `import { Button } from 'govuk-frontend-react-templates'`, `import { Button } from 'govuk-frontend-react-modules'`
- [ ] Use Jest snapshots from govuk-frontend rather than manually copying


## Grey areas

Things that I'm not 100% on how to deal with:

- custom CSS classes such as "width-2" class on Input being passed in as props but are actually CSS modules - could look up via a classNames object first?
- should we allow shortcuts so that `label={{children: 'Label'}}` can just be specified as `label="Label"`? Or should we separate in to two props, `label` and `labelProps`?
12 changes: 7 additions & 5 deletions jest.config.js
@@ -1,13 +1,15 @@
module.exports = {
coverageDirectory: '../coverage/',
coverageDirectory: './coverage/',
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/**/*.js',
'!<rootDir>/**/{stories,example,fixtures}.js',
'!<rootDir>/stories/**',
'<rootDir>/src/**/*.js',
'!<rootDir>/src/**/{stories,example,fixtures}.js',
'!<rootDir>/src/stories/**',
],
rootDir: 'src',
roots: ["<rootDir>/src/"],
moduleNameMapper: {
'\\.(css|scss)$': 'identity-obj-proxy',
},
snapshotSerializers: ['jest-serializer-html'],
setupTestFrameworkScriptFile: "./tests/setup-tests.js",
};