Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a all events button on event dashboard #1057

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading