Skip to content

Commit

Permalink
Breaking: updated to get-form-data@3
Browse files Browse the repository at this point in the history
Checkbox inputs without a value will now return true as their value instead of 'on'
  • Loading branch information
insin committed May 16, 2020
1 parent 73bb46e commit 8ff6008
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sudo: false

language: node_js
node_js:
- 8
- 12

cache:
directories:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Breaking change: updated to get-form-data@3 - checkbox inputs without a `value` will now return `true` as their value when checked, instead of `'on'`.

# 2.0.0 / 2018-01-01

Added React 16 support.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"test:watch": "nwb test --server"
},
"dependencies": {
"get-form-data": "1.2.x",
"get-form-data": "3.0.x",
"prop-types": "^15.5.7"
},
"peerDependencies": {
"react": ">=0.14.9"
},
"devDependencies": {
"eslint-config-jonnybuchanan": "5.0.x",
"nwb": "0.20.x",
"eslint-config-jonnybuchanan": "6.0.x",
"nwb": "0.24.x",
"react": "16.x",
"react-dom": "16.x"
},
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getFormData, {getNamedFormElementData as getFieldData} from 'get-form-data'
import getFormData, {getFieldData} from 'get-form-data'
import t from 'prop-types'
import React from 'react'

Expand Down Expand Up @@ -34,7 +34,7 @@ export default class AutoForm extends React.Component {
let {
children, component: Component, onChange, onSubmit,
trim, trimOnSubmit, // eslint-disable-line no-unused-vars
...props,
...props
} = this.props
return <Component
{...props}
Expand Down
4 changes: 2 additions & 2 deletions tests/AutoForm-test.js → tests/AutoForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let FormWrapper = (props = {}) => () =>
<AutoForm action="/submit" method="POST" {...props}>
<input type="text" name="name" defaultValue="AzureDiamond "/>
<input type="password" name="password" defaultValue="hunter2"/>
<input type="checkbox" name="accepted" value="accepted" defaultChecked/>
<input type="checkbox" name="accepted" defaultChecked/>
<button type="submit">Submit</button>
</AutoForm>

Expand Down Expand Up @@ -51,7 +51,7 @@ describe('AutoForm component', () => {
expect(data).toEqual({
name: 'AzureDiamond ',
password: 'hunter2',
accepted: 'accepted',
accepted: true,
})
done()
},
Expand Down

0 comments on commit 8ff6008

Please sign in to comment.