jason-react-form
Advanced tools
Comparing version 3.3.3 to 3.4.0
{ | ||
"main.js": "/static/js/main.js", | ||
"index.html": "/index.html", | ||
"precache-manifest.36c47436ba74474ef3a8b6c72815e8d0.js": "/precache-manifest.36c47436ba74474ef3a8b6c72815e8d0.js", | ||
"precache-manifest.755c030512739e94e3e291cacd4f84ec.js": "/precache-manifest.755c030512739e94e3e291cacd4f84ec.js", | ||
"service-worker.js": "/service-worker.js" | ||
} |
@@ -17,3 +17,3 @@ /** | ||
importScripts( | ||
"/precache-manifest.36c47436ba74474ef3a8b6c72815e8d0.js" | ||
"/precache-manifest.755c030512739e94e3e291cacd4f84ec.js" | ||
); | ||
@@ -20,0 +20,0 @@ |
{ | ||
"name": "jason-react-form", | ||
"version": "3.3.3", | ||
"version": "3.4.0", | ||
"main": "build/static/js/main.js", | ||
@@ -15,5 +15,3 @@ "license": "MIT", | ||
"config": "npm config set progress=false && npm config set git-tag-version=true", | ||
"clear": "rm -rf ./build", | ||
"snyk-protect": "snyk protect", | ||
"prepare": "npm run snyk-protect" | ||
"clear": "rm -rf ./build" | ||
}, | ||
@@ -153,4 +151,3 @@ "repository": { | ||
"not op_mini all" | ||
], | ||
"snyk": true | ||
] | ||
} |
@@ -131,3 +131,3 @@ import React from 'react'; | ||
Object.assign(userFields, { fields: [...mock] }); | ||
userFields.fields = [...mock]; | ||
@@ -140,2 +140,30 @@ component.instance().updateState(data); | ||
describe('with updated form action', () => { | ||
it('matches action url', () => { | ||
const data = copyState(form); | ||
const component = shallow( | ||
<Form name={'form'} data={data} action={'/'} />, | ||
); | ||
data.action = 'https://updated/form/action'; | ||
component.instance().updateState(data); | ||
expect(component.state().action).toBe('https://updated/form/action'); | ||
}); | ||
}); | ||
describe('without updated form action', () => { | ||
it('matches initial action url', () => { | ||
const data = copyState(form); | ||
const component = shallow( | ||
<Form name={'form'} data={data} action={'/'} />, | ||
); | ||
component.instance().updateState(data); | ||
expect(component.state().action).toBe('/'); | ||
}); | ||
}); | ||
describe('with default values', () => { | ||
@@ -142,0 +170,0 @@ it('does not change state', () => { |
@@ -52,2 +52,3 @@ import axios from 'axios'; | ||
}, | ||
action: this.props.action, | ||
steps: [], | ||
@@ -78,3 +79,3 @@ }; | ||
updateState(state) { | ||
Object.assign(state, { ...this.state }); | ||
Object.assign(state, { ...this.state, action: state.action || this.props.action }); | ||
@@ -135,3 +136,3 @@ this.setState({ ...state }); | ||
const body = this.getFields(); | ||
const response = await axios.post(this.props.action, body); | ||
const response = await axios.post(this.state.action, body); | ||
@@ -138,0 +139,0 @@ this.props.onSubmitSuccess(response); |
{ | ||
"form": { | ||
"action": "/", | ||
"activeStepIndex": 0, | ||
"address": { | ||
"city": "", | ||
"neighborhood": "", | ||
"street": "", | ||
"typeStreet": "", | ||
"uf": "" | ||
}, | ||
"onZipcodeFetchError": {}, | ||
"onZipcodeFetchSuccess": {}, | ||
"stepsCount": 2, | ||
"language": "pt-BR", | ||
@@ -4,0 +16,0 @@ "title": "Form Title", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
472411
4718
78