Make the "Provide more details" field mandatory in the abuse reporting form (#13015)
Make the "Provide more details" field mandatory in the abuse reporting form (#13015)
This commit is contained in:
Родитель
d3c71aa29b
Коммит
35ddd96711
|
@ -397,18 +397,12 @@ export class FeedbackFormBase extends React.Component<InternalProps, State> {
|
|||
)}
|
||||
|
||||
<label className="FeedbackForm-label" htmlFor="feedbackText">
|
||||
{replaceStringsWithJSX({
|
||||
text: i18n.gettext(
|
||||
'Provide more details %(spanStart)s(optional)%(spanEnd)s',
|
||||
),
|
||||
replacements: [
|
||||
['spanStart', 'spanEnd', (text) => <span>{text}</span>],
|
||||
],
|
||||
})}
|
||||
{i18n.gettext('Provide more details')}
|
||||
</label>
|
||||
<Textarea
|
||||
className="FeedbackForm-text"
|
||||
id="feedbackText"
|
||||
required
|
||||
name="text"
|
||||
onChange={this.onFieldChange}
|
||||
value={this.state.text}
|
||||
|
|
|
@ -301,7 +301,7 @@ describe(__filename, () => {
|
|||
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', {
|
||||
name: 'Provide more details (optional)',
|
||||
name: 'Provide more details',
|
||||
}),
|
||||
defaultMessage,
|
||||
);
|
||||
|
@ -358,6 +358,10 @@ describe(__filename, () => {
|
|||
}),
|
||||
defaultLocationLabel,
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -368,7 +372,7 @@ describe(__filename, () => {
|
|||
addonId: defaultAddonGUID,
|
||||
reporterEmail: email,
|
||||
reporterName: name,
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
location: defaultLocation,
|
||||
auth: true,
|
||||
|
@ -390,6 +394,10 @@ describe(__filename, () => {
|
|||
}),
|
||||
defaultLocationLabel,
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: certificationLabel,
|
||||
|
@ -410,7 +418,7 @@ describe(__filename, () => {
|
|||
addonId: defaultAddonGUID,
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_ILLEGAL,
|
||||
location: defaultLocation,
|
||||
auth: false,
|
||||
|
@ -418,6 +426,14 @@ describe(__filename, () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('feedbackText is required', async () => {
|
||||
render();
|
||||
|
||||
expect(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
).toHaveAttribute('required');
|
||||
});
|
||||
|
||||
it('hides the location field when the does_not_work category is selected', async () => {
|
||||
render();
|
||||
|
||||
|
@ -450,6 +466,10 @@ describe(__filename, () => {
|
|||
name: 'It doesn’t work, breaks websites, or slows down Firefox',
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: 'File report anonymously',
|
||||
|
@ -465,7 +485,7 @@ describe(__filename, () => {
|
|||
addonId: defaultAddonGUID,
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: 'does_not_work',
|
||||
location: 'addon',
|
||||
auth: false,
|
||||
|
@ -509,6 +529,10 @@ describe(__filename, () => {
|
|||
name: certificationLabel,
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: 'File report anonymously',
|
||||
|
@ -524,7 +548,7 @@ describe(__filename, () => {
|
|||
addonId,
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_ILLEGAL,
|
||||
location: 'addon',
|
||||
auth: false,
|
||||
|
@ -564,7 +588,7 @@ describe(__filename, () => {
|
|||
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', {
|
||||
name: 'Provide more details (optional)',
|
||||
name: 'Provide more details',
|
||||
}),
|
||||
defaultMessage,
|
||||
);
|
||||
|
@ -639,7 +663,7 @@ describe(__filename, () => {
|
|||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', {
|
||||
name: 'Provide more details (optional)',
|
||||
name: 'Provide more details',
|
||||
}),
|
||||
defaultMessage,
|
||||
);
|
||||
|
|
|
@ -297,6 +297,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -307,7 +311,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(authorId, collectionSlug),
|
||||
reporterEmail: signedInEmail,
|
||||
reporterName: signedInName,
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: true,
|
||||
}),
|
||||
|
@ -330,6 +334,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: 'File report anonymously',
|
||||
|
@ -345,7 +353,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(authorId, collectionSlug),
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: false,
|
||||
}),
|
||||
|
@ -471,6 +479,10 @@ describe(__filename, () => {
|
|||
name: 'File report anonymously',
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -481,7 +493,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(authorId, collectionSlug),
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_FEEDBACK_SPAM,
|
||||
auth: false,
|
||||
}),
|
||||
|
@ -544,6 +556,10 @@ describe(__filename, () => {
|
|||
name: 'File report anonymously',
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
|
|
|
@ -331,6 +331,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: 'File report anonymously',
|
||||
|
@ -346,7 +350,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(ratingId),
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: false,
|
||||
}),
|
||||
|
@ -367,6 +371,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -377,7 +385,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(ratingId),
|
||||
reporterEmail: signedInEmail,
|
||||
reporterName: signedInName,
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: true,
|
||||
}),
|
||||
|
@ -398,6 +406,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: 'File report anonymously',
|
||||
|
@ -413,7 +425,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(ratingId),
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: false,
|
||||
}),
|
||||
|
@ -478,6 +490,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('checkbox', {
|
||||
name: 'File report anonymously',
|
||||
|
|
|
@ -316,6 +316,10 @@ describe(__filename, () => {
|
|||
name: 'File report anonymously',
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -326,7 +330,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(userId),
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_FEEDBACK_SPAM,
|
||||
auth: false,
|
||||
}),
|
||||
|
@ -347,6 +351,10 @@ describe(__filename, () => {
|
|||
await userEvent.click(
|
||||
screen.getByRole('radio', { name: 'Something else' }),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -357,7 +365,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(userId),
|
||||
reporterEmail: signedInEmail,
|
||||
reporterName: signedInName,
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: true,
|
||||
}),
|
||||
|
@ -383,6 +391,10 @@ describe(__filename, () => {
|
|||
name: 'File report anonymously',
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
);
|
||||
|
@ -393,7 +405,7 @@ describe(__filename, () => {
|
|||
errorHandlerId: getErrorHandlerId(userId),
|
||||
reporterEmail: '',
|
||||
reporterName: '',
|
||||
message: '',
|
||||
message: 'Some details...',
|
||||
reason: CATEGORY_SOMETHING_ELSE,
|
||||
auth: false,
|
||||
}),
|
||||
|
@ -458,6 +470,10 @@ describe(__filename, () => {
|
|||
name: 'File report anonymously',
|
||||
}),
|
||||
);
|
||||
await userEvent.type(
|
||||
screen.getByRole('textbox', { name: 'Provide more details' }),
|
||||
'Some details...',
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Submit report' }),
|
||||
|
|
Загрузка…
Ссылка в новой задаче