Skip to content

Commit

Permalink
fix: 🐛 address the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mitra-deriv committed May 22, 2024
1 parent 3a01e4e commit 5392a55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ describe('<RadioButtonGroup/>', () => {
expect(screen.getByText('samplelable')).toBeInTheDocument();
});

it('should not display label if is_title_enabled is false', () => {
render(<RadioButtonGroup {...props} is_title_enabled={false} />);
it('should not display label if label is not passed', () => {
delete props.label;
render(<RadioButtonGroup {...props} />);
expect(screen.queryByText('samplelable')).not.toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState } from 'react';
import React from 'react';
import classNames from 'classnames';

export type TRadioButtonGroup = {
className: string;
is_fiat?: boolean;
is_title_enabled?: boolean;
item_count: number;
label?: string;
description?: React.ReactNode;
Expand All @@ -25,14 +24,13 @@ const RadioButtonGroup = ({
children,
label,
className,
is_title_enabled = true,
is_fiat,
item_count,
description,
}: React.PropsWithChildren<TRadioButtonGroup>) => {
return (
<div className={className}>
{is_title_enabled && (
{label && (
<h2
className={classNames(`${className}--is-header`, {
'currency-selector__is-crypto': !is_fiat,
Expand Down

0 comments on commit 5392a55

Please sign in to comment.