},
{
key: RuleDescriptionSections.HOW_TO_FIX,
- content: 'This how to fix for spring',
+ content: 'This is how to fix for spring',
context: { key: 'spring', displayName: 'Spring' }
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
- content: 'This how to fix for spring boot',
+ content: 'This is how to fix for spring boot',
context: { key: 'spring_boot', displayName: 'Spring boot' }
},
{
expect(screen.getByRole('radio', { name: 'Spring' })).toBeInTheDocument();
expect(screen.getByRole('radio', { name: 'Spring boot' })).toBeInTheDocument();
expect(
- screen.getByRole('radio', { name: 'coding_rules.description_context_other' })
+ screen.getByRole('radio', { name: 'coding_rules.description_context.other' })
).toBeInTheDocument();
- expect(screen.getByText('This how to fix for spring')).toBeInTheDocument();
+ expect(screen.getByText('coding_rules.description_context.sub_title.Spring')).toBeInTheDocument();
+ expect(screen.getByText('This is how to fix for spring')).toBeInTheDocument();
await user.click(screen.getByRole('radio', { name: 'Spring boot' }));
- expect(screen.getByText('This how to fix for spring boot')).toBeInTheDocument();
+ expect(
+ screen.getByText('coding_rules.description_context.sub_title.Spring boot')
+ ).toBeInTheDocument();
+ expect(screen.getByText('This is how to fix for spring boot')).toBeInTheDocument();
- await user.click(screen.getByRole('radio', { name: 'coding_rules.description_context_other' }));
+ await user.click(screen.getByRole('radio', { name: 'coding_rules.description_context.other' }));
+ expect(
+ screen.queryByText(
+ 'coding_rules.description_context.sub_title.coding_rules.description_context.other'
+ )
+ ).not.toBeInTheDocument();
expect(screen.getByText('coding_rules.context.others.title')).toBeInTheDocument();
expect(screen.getByText('coding_rules.context.others.description.first')).toBeInTheDocument();
expect(screen.getByRole('radio', { name: 'Context 3' })).toBeInTheDocument();
expect(screen.getByRole('radio', { name: 'Spring' })).toBeInTheDocument();
expect(
- screen.getByRole('radio', { name: 'coding_rules.description_context_other' })
+ screen.getByRole('radio', { name: 'coding_rules.description_context.other' })
).toBeInTheDocument();
expect(screen.getByRole('radio', { name: 'Spring' })).toBeChecked();
expect(screen.getByText('Context 2 content')).toBeInTheDocument();
// Select the "other" context and check tab content
- await user.click(screen.getByRole('radio', { name: 'coding_rules.description_context_other' }));
+ await user.click(screen.getByRole('radio', { name: 'coding_rules.description_context.other' }));
expect(screen.getByText('coding_rules.context.others.title')).toBeInTheDocument();
expect(screen.getByText('coding_rules.context.others.description.first')).toBeInTheDocument();
expect(screen.getByText('coding_rules.context.others.description.second')).toBeInTheDocument();
if (contexts.length > 0) {
contexts.push({
- displayName: translate('coding_rules.description_context_other'),
+ displayName: translate('coding_rules.description_context.other'),
content: '',
key: OTHERS_KEY
});
})}>
<div className="rules-context-description">
<h2 className="rule-contexts-title">
- {translate('coding_rules.description_context_title')}
+ {translate('coding_rules.description_context.title')}
</h2>
{defaultContext && (
<Alert variant="info" display="inline" className="big-spacer-bottom">
{translateWithParameters(
- 'coding_rules.description_context_default_information',
+ 'coding_rules.description_context.default_information',
defaultContext.displayName
)}
</Alert>
)}
<div>
<RadioToggle
- className="big-spacer-bottom"
name="filter"
onCheck={this.handleToggleContext}
options={options}
value={selectedContext.displayName}
/>
+ {selectedContext.key !== OTHERS_KEY && (
+ <h2>
+ {translateWithParameters(
+ 'coding_rules.description_context.sub_title',
+ selectedContext.displayName
+ )}
+ </h2>
+ )}
</div>
{selectedContext.key === OTHERS_KEY ? (
<OtherContextOption />
coding_rules.description_section.title.how_to_fix=How to fix it?
coding_rules.description_section.title.more_info=More Info
-coding_rules.description_context_title=Which component or framework contains the issue?
-coding_rules.description_context_default_information={0} was detected as the most relevant component or framework for this issue.
-coding_rules.description_context_other=Other
+coding_rules.description_context.title=Which component or framework contains the issue?
+coding_rules.description_context.sub_title=How to fix it in {0}
+coding_rules.description_context.default_information={0} was detected as the most relevant component or framework for this issue.
+coding_rules.description_context.other=Other
coding_rules.more_info.education_principles.title=Security principles
coding_rules.more_info.resources.title=Resources