|
1 | 1 | import Form from './Form.vue';
|
| 2 | +import FormErrorSummary from './FormErrorSummary.vue'; |
2 | 3 | import {useContainerStateManager} from '@/composables/useContainerStateManager';
|
3 | 4 | import FormBase from './mocks/form-base';
|
4 | 5 | import FormMultilingual from './mocks/form-multilingual';
|
@@ -126,3 +127,44 @@ export const WithErrors = {
|
126 | 127 |
|
127 | 128 | args: {},
|
128 | 129 | };
|
| 130 | + |
| 131 | +export const WithErrorSummary = { |
| 132 | + render: (args) => ({ |
| 133 | + components: {PkpForm: Form, FormErrorSummary}, |
| 134 | + setup() { |
| 135 | + const {get, set, components} = useContainerStateManager(); |
| 136 | + set('example', { |
| 137 | + ...FormUser, |
| 138 | + ...args, |
| 139 | + errors: { |
| 140 | + email: ['Please provide a valid email address'], |
| 141 | + affiliation: { |
| 142 | + en: ['You must enter your affiliation in English.'], |
| 143 | + fr_CA: ['You must enter your affiliation in French.'], |
| 144 | + ar: ['You must enter your affiliation in Arabic.'], |
| 145 | + }, |
| 146 | + 'user-locales': ['You must select at least two options.'], |
| 147 | + bio: { |
| 148 | + en: [ |
| 149 | + 'Please provide a bio statement to accompany your publication.', |
| 150 | + ], |
| 151 | + }, |
| 152 | + country: ['Please select your country.'], |
| 153 | + 'mailing-address': [ |
| 154 | + 'You must enter a mailing address where you can receive post.', |
| 155 | + ], |
| 156 | + }, |
| 157 | + }); |
| 158 | + |
| 159 | + return {args, get, set, components}; |
| 160 | + }, |
| 161 | + template: ` |
| 162 | + <FormErrorSummary :errors="components.example.errors"/> |
| 163 | + <PkpForm v-bind="components.example" @set="set" /> |
| 164 | + `, |
| 165 | + }), |
| 166 | + |
| 167 | + args: { |
| 168 | + showErrorFooter: false, |
| 169 | + }, |
| 170 | +}; |
0 commit comments