diff --git a/src/components/@atoms/Calendar/Calendar.test.tsx b/src/components/@atoms/Calendar/Calendar.test.tsx index 08e43ee52..96fe2ef0c 100644 --- a/src/components/@atoms/Calendar/Calendar.test.tsx +++ b/src/components/@atoms/Calendar/Calendar.test.tsx @@ -1,6 +1,5 @@ -import { fireEvent, render, screen } from '@app/test-utils' +import { fireEvent, mockFunction, render, screen } from '@app/test-utils' -import { fireEvent } from '@testing-library/react' import { InputHTMLAttributes, useState } from 'react' import { describe, expect, it, vi } from 'vitest' @@ -8,7 +7,18 @@ import { secondsToDate, secondsToDateInput } from '@app/utils/date' import { formatExpiry } from '@app/utils/utils' import { Calendar } from './Calendar' +import { useBreakpoint } from '@app/utils/BreakpointProvider' +vi.mock('@app/utils/BreakpointProvider') + +const mockUseBreakpoint = mockFunction(useBreakpoint) +mockUseBreakpoint.mockReturnValue({ + xs: true, + sm: true, + md: true, + lg: false, + xl: false, +}) const value = 3600 const min = 0 diff --git a/src/components/@atoms/Calendar/Calendar.tsx b/src/components/@atoms/Calendar/Calendar.tsx index 57e948a8b..37b7db57c 100644 --- a/src/components/@atoms/Calendar/Calendar.tsx +++ b/src/components/@atoms/Calendar/Calendar.tsx @@ -3,6 +3,7 @@ import styled, { css } from 'styled-components' import CalendarSVG from '@app/assets/Calendar.svg' import { useDefaultRef } from '@app/hooks/useDefaultRef' +import { useBreakpoint } from '@app/utils/BreakpointProvider' import { secondsToDate, secondsToDateInput } from '@app/utils/date' import { formatExpiry } from '@app/utils/utils' @@ -80,6 +81,8 @@ export const Calendar = forwardRef( const [minDuratiion] = useState(min ?? value) const minDate = secondsToDate(minDuratiion) + const breakpoint = useBreakpoint() + return (