-
-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Rob Gietema <rob.gietema@gmail.com>
- Loading branch information
1 parent
3929ece
commit b3e8bed
Showing
11 changed files
with
158 additions
and
53 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 @@ | ||
Add global form state. @robgietema |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
/** | ||
* Form actions. | ||
* @module actions/form/form | ||
*/ | ||
|
||
import { SET_FORM_DATA } from '@plone/volto/constants/ActionTypes'; | ||
|
||
/** | ||
* Set form data function. | ||
* @function setFormData | ||
* @param {Object} data New form data. | ||
* @returns {Object} Set sidebar action. | ||
*/ | ||
export function setFormData(data) { | ||
return { | ||
type: SET_FORM_DATA, | ||
data, | ||
}; | ||
} |
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,14 @@ | ||
import { setFormData } from './form'; | ||
import { SET_FORM_DATA } from '@plone/volto/constants/ActionTypes'; | ||
|
||
describe('Form action', () => { | ||
describe('setFormData', () => { | ||
it('should create an action to set the form data', () => { | ||
const data = { foo: 'bar' }; | ||
const action = setFormData(data); | ||
|
||
expect(action.type).toEqual(SET_FORM_DATA); | ||
expect(action.data).toEqual(data); | ||
}); | ||
}); | ||
}); |
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
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
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
Oops, something went wrong.