export { BranchIcon } from './BranchIcon';
export { BugIcon } from './BugIcon';
export { CalendarIcon } from './CalendarIcon';
+export { CheckIcon } from './CheckIcon';
export { ChevronDownIcon } from './ChevronDownIcon';
export { ChevronLeftIcon } from './ChevronLeftIcon';
export { ChevronRightIcon } from './ChevronRightIcon';
export { ClockIcon } from './ClockIcon';
+export { CloseIcon } from './CloseIcon';
export { CodeSmellIcon } from './CodeSmellIcon';
export { CommentIcon } from './CommentIcon';
export { CopyIcon } from './CopyIcon';
name: 'coding_rules.description_section.title.how_to_fix',
})
);
- expect(screen.getByRole('button', { name: 'Spring' })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Spring boot' })).toBeInTheDocument();
+ expect(screen.getByRole('radio', { name: 'Spring' })).toBeInTheDocument();
+ expect(screen.getByRole('radio', { name: 'Spring boot' })).toBeInTheDocument();
expect(
- screen.getByRole('button', { name: 'coding_rules.description_context.other' })
+ screen.getByRole('radio', { name: 'coding_rules.description_context.other' })
).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('button', { name: 'Spring boot' }));
+ await user.click(screen.getByRole('radio', { name: 'Spring boot' }));
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('button', { 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'
expect(screen.getByText('coding_rules.context.others.description.first')).toBeInTheDocument();
const productBoardLink = screen.getByRole('link', {
- name: 'opens_in_new_window coding_rules.context.others.feedback_description.link',
+ name: 'coding_rules.context.others.feedback_description.link',
});
expect(productBoardLink).toBeInTheDocument();
expect(productBoardLink).toHaveAttribute('target', '_blank');
);
// Is the context selector present with the expected values and default selection?
- expect(screen.getByRole('button', { name: 'Context 2' })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Context 3' })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Spring' })).toBeInTheDocument();
+ expect(screen.getByRole('radio', { name: 'Context 2' })).toBeInTheDocument();
+ expect(screen.getByRole('radio', { name: 'Context 3' })).toBeInTheDocument();
+ expect(screen.getByRole('radio', { name: 'Spring' })).toBeInTheDocument();
expect(
- screen.getByRole('button', { name: 'coding_rules.description_context.other' })
+ screen.getByRole('radio', { name: 'coding_rules.description_context.other' })
).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Spring' })).toHaveClass('selected');
+ expect(screen.getByRole('radio', { name: 'Spring', current: true })).toBeInTheDocument();
// Select context 2 and check tab content
- await user.click(screen.getByRole('button', { name: 'Context 2' }));
+ await user.click(screen.getByRole('radio', { name: 'Context 2' }));
expect(screen.getByText('Context 2 content')).toBeInTheDocument();
// Select the "other" context and check tab content
await user.click(
- screen.getByRole('button', { name: 'coding_rules.description_context.other' })
+ 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();
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { CheckIcon, CloseIcon, Link } from 'design-system';
import * as React from 'react';
import { translate } from '../../helpers/l10n';
-import Link from '../common/Link';
-import CheckIcon from '../icons/CheckIcon';
-import ClearIcon from '../icons/ClearIcon';
export default function OtherContextOption() {
return (
<p>{translate('coding_rules.context.others.description.first')}</p>
<p>{translate('coding_rules.context.others.description.second')}</p>
<p>
- <span className="display-block big-spacer-left">
- <CheckIcon className="spacer-right" fill="green" />
+ <span className="sw-flex sw-items-center sw-ml-4">
+ <CheckIcon className="sw-mr-2" fill="iconSuccess" />
{translate('coding_rules.context.others.description.do')}
</span>
- <span className="display-block big-spacer-left">
- <ClearIcon className="spacer-right" fill="red" />
+ <span className="sw-flex sw-items-center sw-ml-4">
+ <CloseIcon className="sw-mr-2" fill="iconError" />
{translate('coding_rules.context.others.description.dont')}
</span>
</p>
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import styled from '@emotion/styled';
-import { HtmlFormatter, themeBorder, themeColor } from 'design-system';
+import { FlagMessage, HtmlFormatter, themeBorder, themeColor, ToggleButton } from 'design-system';
import * as React from 'react';
import { RuleDescriptionSection } from '../../apps/coding-rules/rule';
import applyCodeDifferences from '../../helpers/code-difference';
import { translate, translateWithParameters } from '../../helpers/l10n';
import { sanitizeString } from '../../helpers/sanitize';
-import ButtonToggle from '../controls/ButtonToggle';
-import { Alert } from '../ui/Alert';
import OtherContextOption from './OtherContextOption';
const OTHERS_KEY = 'others';
return (
<StyledHtmlFormatter
className={className}
- ref={(node) => {
+ ref={(node: HTMLDivElement) => {
applyCodeDifferences(node);
}}
>
{translate('coding_rules.description_context.title')}
</h2>
{defaultContext && (
- <Alert variant="info" display="inline" className="big-spacer-bottom">
+ <FlagMessage
+ variant="info"
+ className="sw-mb-4"
+ ariaLabel={translateWithParameters(
+ 'coding_rules.description_context.default_information',
+ defaultContext.displayName
+ )}
+ >
{translateWithParameters(
'coding_rules.description_context.default_information',
defaultContext.displayName
)}
- </Alert>
+ </FlagMessage>
)}
- <div className="big-spacer-bottom">
- <ButtonToggle
+ <div className="sw-mb-4">
+ <ToggleButton
label={translate('coding_rules.description_context.title')}
- onCheck={this.handleToggleContext}
+ onChange={this.handleToggleContext}
options={options}
value={selectedContext.displayName}
/>
return (
<StyledHtmlFormatter
className={className}
- ref={(node) => {
+ ref={(node: HTMLDivElement) => {
applyCodeDifferences(node);
}}
// eslint-disable-next-line react/no-danger