fix: allow grace period minutes only (#1064)
* fix: allow grace period minutes only * fix: zero minutes error
This commit is contained in:
@@ -48,6 +48,26 @@ describe('<DeadlineSection />', () => {
|
||||
expect(testObj.gracePeriod.minutes).toBe(13);
|
||||
});
|
||||
});
|
||||
it('checking deadline input value if grace Period has no hours', async () => {
|
||||
const { getByTestId } = render(<RootWrapper
|
||||
gracePeriod={{ hours: 0, minutes: 13 }}
|
||||
setGradingData={setGradingData}
|
||||
/>);
|
||||
await waitFor(() => {
|
||||
const inputElement = getByTestId('deadline-period-input');
|
||||
expect(inputElement.value).toBe('00:13');
|
||||
});
|
||||
});
|
||||
it('checking deadline input value if grace Period has no minutes', async () => {
|
||||
const { getByTestId } = render(<RootWrapper
|
||||
gracePeriod={{ hours: 13, minutes: 0 }}
|
||||
setGradingData={setGradingData}
|
||||
/>);
|
||||
await waitFor(() => {
|
||||
const inputElement = getByTestId('deadline-period-input');
|
||||
expect(inputElement.value).toBe('13:00');
|
||||
});
|
||||
});
|
||||
it('checking deadline input value if grace Period equal null', async () => {
|
||||
const { getByTestId } = render(<RootWrapper gracePeriod={null} setGradingData={setGradingData} />);
|
||||
await waitFor(() => {
|
||||
|
||||
@@ -12,7 +12,7 @@ const DeadlineSection = ({
|
||||
intl, setShowSavePrompt, gracePeriod, setGradingData, setShowSuccessAlert,
|
||||
}) => {
|
||||
const timeStampValue = gracePeriod
|
||||
? gracePeriod.hours && `${formatTime(gracePeriod.hours)}:${formatTime(gracePeriod.minutes)}`
|
||||
? `${formatTime(gracePeriod.hours)}:${formatTime(gracePeriod.minutes)}`
|
||||
: DEFAULT_TIME_STAMP;
|
||||
const [newDeadlineValue, setNewDeadlineValue] = useState(timeStampValue);
|
||||
const [isError, setIsError] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user