Skip to content

Commit

Permalink
Make Badge priority class always present like in all other components
Browse files Browse the repository at this point in the history
This change affects output HTML and may break downstream snapshot tests.
  • Loading branch information
adamkudrna committed Aug 31, 2024
1 parent b2ed7cd commit 025f546
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/Badge/Badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { withGlobalProps } from '../../provider';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
import styles from './Badge.module.scss';

export const Badge = ({
Expand All @@ -16,7 +17,7 @@ export const Badge = ({
{...transferProps(restProps)}
className={classNames(
styles.root,
priority === 'outline' && styles.isRootPriorityOutline,
getRootPriorityClassName(priority, styles),
getRootColorClassName(color, styles),
)}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Badge/__tests__/Badge.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('rendering', () => {
],
[
{ priority: 'filled' },
(rootElement) => expect(rootElement).not.toHaveClass('isRootPriorityOutline'),
(rootElement) => expect(rootElement).toHaveClass('isRootPriorityFilled'),
],
[
{ priority: 'outline' },
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { withGlobalProps } from '../../provider';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
import { ButtonGroupContext } from '../ButtonGroup';
import { InputGroupContext } from '../InputGroup/InputGroupContext';
import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
import styles from './Button.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ButtonGroup/ButtonGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {
import { withGlobalProps } from '../../provider';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
import styles from './ButtonGroup.module.scss';
import { ButtonGroupContext } from './ButtonGroupContext';
Expand Down
2 changes: 1 addition & 1 deletion src/components/_helpers/getRootPriorityClassName.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default (priority, styles) => {
export const getRootPriorityClassName = (priority, styles) => {
if (priority === 'filled') {
return styles.isRootPriorityFilled;
}
Expand Down

0 comments on commit 025f546

Please sign in to comment.