From 9c10301688b2505d936dae420ee271c3a58eddb4 Mon Sep 17 00:00:00 2001 From: Farrah Mae Ochoa Date: Tue, 11 Jun 2024 16:16:18 +0400 Subject: [PATCH 1/3] fix: disable advert menu --- .../PopoverDropdown/PopoverDropdown.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/PopoverDropdown/PopoverDropdown.tsx b/src/components/PopoverDropdown/PopoverDropdown.tsx index 0a999020..d22fedbb 100644 --- a/src/components/PopoverDropdown/PopoverDropdown.tsx +++ b/src/components/PopoverDropdown/PopoverDropdown.tsx @@ -25,13 +25,17 @@ const PopoverDropdown = ({ dropdownList, onClick, tooltipMessage }: TPopoverDrop return (
- - setVisible(prevState => !prevState)} - /> - + {isAdvertiserBarred ? ( + + ) : ( + + setVisible(prevState => !prevState)} + /> + + )} {visible && (
{dropdownList.map(item => ( From dc3bfbe4d36bcb3385d21c987dc663a967a378c8 Mon Sep 17 00:00:00 2001 From: Farrah Mae Ochoa Date: Tue, 11 Jun 2024 16:27:27 +0400 Subject: [PATCH 2/3] fix: test --- src/components/PopoverDropdown/PopoverDropdown.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/PopoverDropdown/PopoverDropdown.tsx b/src/components/PopoverDropdown/PopoverDropdown.tsx index d22fedbb..98b5013d 100644 --- a/src/components/PopoverDropdown/PopoverDropdown.tsx +++ b/src/components/PopoverDropdown/PopoverDropdown.tsx @@ -26,7 +26,11 @@ const PopoverDropdown = ({ dropdownList, onClick, tooltipMessage }: TPopoverDrop return (
{isAdvertiserBarred ? ( - + ) : ( Date: Tue, 11 Jun 2024 17:01:46 +0400 Subject: [PATCH 3/3] fix: test --- .../PopoverDropdown/__tests__/PopoverDropdown.spec.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/PopoverDropdown/__tests__/PopoverDropdown.spec.tsx b/src/components/PopoverDropdown/__tests__/PopoverDropdown.spec.tsx index 181f51db..1c734176 100644 --- a/src/components/PopoverDropdown/__tests__/PopoverDropdown.spec.tsx +++ b/src/components/PopoverDropdown/__tests__/PopoverDropdown.spec.tsx @@ -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(); - 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'); }); });