Skip to content
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
24 changes: 24 additions & 0 deletions src/features/dashboard/pages/OpenSourceWeekPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,28 @@ describe('OpenSourceWeekPage', () => {

expect(mockOnEventClick).toHaveBeenCalledWith('123', 'Click Me')
})

it('navigates to the event when Join Event is clicked', async () => {
;(getOpenSourceWeekEvents as any).mockResolvedValue({
events: [
{
id: '456',
title: 'Join Me',
description: 'Desc',
location: 'Remote',
status: 'upcoming',
start_at: '2023-01-01T10:00:00Z',
end_at: '2023-01-07T10:00:00Z',
},
],
})

renderPage()
await waitFor(() => expect(screen.getByText('Join Me')).toBeInTheDocument())

await userEvent.click(screen.getByRole('button', { name: 'Join Event' }))

expect(mockOnEventClick).toHaveBeenCalledTimes(1)
expect(mockOnEventClick).toHaveBeenCalledWith('456', 'Join Me')
})
})
9 changes: 8 additions & 1 deletion src/features/dashboard/pages/OpenSourceWeekPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@ export function OpenSourceWeekPage({ onEventClick }: OpenSourceWeekPageProps) {
</span>
</div>
</div>
<button className="w-full sm:w-auto px-6 py-3 bg-gradient-to-br from-[#c9983a] to-[#a67c2e] text-white rounded-[14px] font-semibold text-[13px] sm:text-[14px] shadow-[0_6px_20px_rgba(162,121,44,0.35)] hover:shadow-[0_8px_24px_rgba(162,121,44,0.4)] transition-all border border-white/10">
<button
type="button"
onClick={(clickEvent) => {
clickEvent.stopPropagation()
onEventClick(event.id, event.title)
}}
className="w-full sm:w-auto px-6 py-3 bg-gradient-to-br from-[#c9983a] to-[#a67c2e] text-white rounded-[14px] font-semibold text-[13px] sm:text-[14px] shadow-[0_6px_20px_rgba(162,121,44,0.35)] hover:shadow-[0_8px_24px_rgba(162,121,44,0.4)] transition-all border border-white/10"
>
Join Event
</button>
</div>
Expand Down
Loading