Skip to content

Commit

Permalink
Merge pull request #120 from farrah-deriv/P2PS-2883/disable-ad-menu
Browse files Browse the repository at this point in the history
farrah/P2PS-2883/fix: disable advert menu
  • Loading branch information
farrah-deriv authored Jun 14, 2024
2 parents ed8e8df + 0e23d4c commit 7837d5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
18 changes: 11 additions & 7 deletions src/components/PopoverDropdown/PopoverDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ const PopoverDropdown = ({ dropdownList, onClick, tooltipMessage }: TPopoverDrop

return (
<div className='popover-dropdown' ref={ref}>
<TooltipMenuIcon
as='button'
onClick={() => setVisible(prevState => !prevState)}
tooltipContent={tooltipMessage}
>
<LabelPairedEllipsisVerticalLgBoldIcon data-testid='dt_popover_dropdown_icon' />
</TooltipMenuIcon>
{isAdvertiserBarred ? (
<LabelPairedEllipsisVerticalLgBoldIcon data-testid='dt_popover_dropdown_icon' fill='#999999' />
) : (
<TooltipMenuIcon
as='button'
onClick={() => setVisible(prevState => !prevState)}
tooltipContent={tooltipMessage}
>
<LabelPairedEllipsisVerticalLgBoldIcon data-testid='dt_popover_dropdown_icon' />
</TooltipMenuIcon>
)}
{visible && (
<div className='popover-dropdown__list'>
{dropdownList.map(item => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ describe('PopoverDropdown', () => {
expect(mockProps.onClick).toHaveBeenCalledWith('value 1');
});

it('should disable the button if advertiser is barred', async () => {
it('should disable the icon if advertiser is barred', async () => {
mockUseIsAdvertiserBarred.mockReturnValue(true);
render(<PopoverDropdown {...mockProps} />);
await userEvent.click(screen.getByTestId('dt_popover_dropdown_icon'));
expect(screen.getByRole('button', { name: 'label 1' })).toBeDisabled();
expect(screen.getByTestId('dt_popover_dropdown_icon')).not.toHaveProperty('onClick');
});
});

0 comments on commit 7837d5f

Please sign in to comment.