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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('EventsGroup', () => {
expect(onClickEvent).not.toHaveBeenCalled()
})

it('calls onClickEvent when event has url', async () => {
it('does not call onClickEvent when event has url', async () => {
const user = userEvent.setup()
const onClickEvent = jest.fn()
const event = { ...baseEvent, url: 'https://example.com/evaluation-2' }
Expand All @@ -62,7 +62,7 @@ describe('EventsGroup', () => {

await user.click(screen.getByText('Se habilita para responder “Evaluación 2”'))

expect(onClickEvent).toHaveBeenCalledWith(event)
expect(onClickEvent).not.toHaveBeenCalled()
})

it('renders headquarters address for cpr events', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const EventsGroup = ({
}: IEventsGroupProps): JSX.Element => {
if (!events || (events && events.length === 0)) return <></>

const eventClicksEnabled = false

return (
<>
<Box
Expand All @@ -53,12 +55,15 @@ export const EventsGroup = ({
<Box
bg={vars('colors-neutral-white') ?? '#FFFFFF'}
border="none"
cursor={eventOnClick ? 'pointer' : 'default'}
cursor={eventClicksEnabled && eventOnClick ? 'pointer' : 'default'}
padding="0"
key={event.id}
_hover={{
boxShadow: 'none !important',
cursor: eventOnClick ? 'pointer !important' : 'default !important',
cursor:
eventClicksEnabled && eventOnClick
? 'pointer !important'
: 'default !important',
bg: 'none !important',
}}
_focus={{
Expand Down
4 changes: 2 additions & 2 deletions src/organisms/Calendar/EventsList/EventsList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const renderComponent = (
)

describe('EventsList', () => {
it('calls onClick when the item is clicked', async () => {
it('does not call onClick when the item is clicked even with url', async () => {
const onClick = jest.fn()
const user = userEvent.setup()

renderComponent(onClick, { url: '/demo' })

await user.click(screen.getByText('Evento demo'))

expect(onClick).toHaveBeenCalledTimes(1)
expect(onClick).not.toHaveBeenCalled()
})

it('does not call onClick when url is not provided', async () => {
Expand Down
3 changes: 2 additions & 1 deletion src/organisms/Calendar/EventsList/EventsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export const EventsList = ({
const hoverBg = vars('colors-neutral-cultured2') ?? '#F8F8F8'
const hasUrl = Boolean(url)
const isAvailable = url === undefined ? true : hasUrl
const isClickable = Boolean(onClick) && hasUrl
const eventClicksEnabled = false
const isClickable = eventClicksEnabled && Boolean(onClick) && hasUrl
const disabledOpacity = isAvailable ? 1 : 0.5
const isCpr = type === 'cpr'
const showEventLocation = !isCpr || Boolean(headquartersAddress)
Expand Down
Loading