Skip to content

Commit

Permalink
created a return button on event dashboard (PalisadoesFoundation#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanhaiya04 committed Nov 14, 2023
1 parent 556bd03 commit 2c978a9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const props: InterfaceLeftDrawerProps = {
title: 'Test Event',
description: 'Test Description',
organization: {
_id: 'Test Organization',
_id: 'TestOrganization',
},
},
hideDrawer: false,
Expand Down Expand Up @@ -218,4 +218,21 @@ describe('Testing Left Drawer component for the Event Dashboard', () => {
expect(truncatedEventTitle).toContain('...');
expect(truncatedEventDescription).toContain('...');
});
test('Testing all events button', async () => {
localStorage.setItem('UserType', 'SUPERADMIN');
render(
<MockedProvider mocks={mocks}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<LeftDrawerEvent {...props} />
</I18nextProvider>
</BrowserRouter>
</MockedProvider>
);

userEvent.click(screen.getByTestId('allEventsBtn'));
expect(global.window.location.pathname).toBe(
`/orgevents/id=${props.event.organization._id}`
);
});
});
14 changes: 14 additions & 0 deletions src/components/LeftDrawerEvent/LeftDrawerEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@ const leftDrawerEvent = ({
eventId={event._id}
key={`${event?._id || 'loading'}Stats`}
/>
<Button
variant="light"
data-testid="allEventsBtn"
className="text-secondary"
aria-label="allEvents"
onClick={(): void => {
history.push(`/orgevents/id=${event.organization._id}`);
}}
>
<div className={styles.iconWrapper}>
<IconComponent name="Events" fill="var(--bs-secondary)" />
</div>
All Events
</Button>
</div>

{/* Profile Section & Logout Btn */}
Expand Down

0 comments on commit 2c978a9

Please sign in to comment.