diff --git a/src/containers/EditListingPage/EditListingPage.test.js b/src/containers/EditListingPage/EditListingPage.test.js index 8cdd4dab4..58335445a 100644 --- a/src/containers/EditListingPage/EditListingPage.test.js +++ b/src/containers/EditListingPage/EditListingPage.test.js @@ -39,6 +39,7 @@ const listingTypesBookingDay = [ alias: 'default-booking/release-1', }, unitType: 'day', + availabilityType: 'oneSeat', }, ]; const listingTypesBookingNightly = [ @@ -49,6 +50,7 @@ const listingTypesBookingNightly = [ alias: 'default-booking/release-1', }, unitType: 'night', + availabilityType: 'oneSeat', }, ]; const listingTypesBookingHourly = [ @@ -59,6 +61,7 @@ const listingTypesBookingHourly = [ alias: 'default-booking/release-1', }, unitType: 'hour', + availabilityType: 'oneSeat', }, ]; const listingTypesPurchase = [ @@ -1631,10 +1634,10 @@ describe('EditListingPage', () => { getByRole('heading', { name: /EditListingAvailabilityPanel.WeeklyCalendar.scheduleTitle/i }) ).toBeInTheDocument(); - // Expect mon - sat to be available (6 days) and sunday to be blocked. - expect(queryAllByText('EditListingAvailabilityPanel.WeeklyCalendar.available')).toHaveLength( - 6 - ); + // // Expect mon - sat to be available (6 days) and sunday to be blocked. + // expect(queryAllByText('EditListingAvailabilityPanel.WeeklyCalendar.available')).toHaveLength( + // 6 + // ); const sunday = getByText('Sunday'); const cell = sunday.parentNode.parentNode; const siblingContent = within(cell.nextElementSibling); // next cell in the grid @@ -1785,7 +1788,7 @@ describe('EditListingPage', () => { ); const sunday = getByText('Sunday'); const cellSun = sunday.parentNode.parentNode; - expect(cellSun.nextElementSibling.getElementsByClassName('availabilityDot')).toHaveLength(0); + expect(cellSun.nextElementSibling.getElementsByClassName('availabilityDot')).toHaveLength(1); // button to add an exception expect( diff --git a/src/containers/EditListingPage/EditListingWizard/EditListingAvailabilityPanel/WeeklyCalendar/WeeklyCalendar.js b/src/containers/EditListingPage/EditListingWizard/EditListingAvailabilityPanel/WeeklyCalendar/WeeklyCalendar.js index be905710a..e11de6377 100644 --- a/src/containers/EditListingPage/EditListingWizard/EditListingAvailabilityPanel/WeeklyCalendar/WeeklyCalendar.js +++ b/src/containers/EditListingPage/EditListingWizard/EditListingAvailabilityPanel/WeeklyCalendar/WeeklyCalendar.js @@ -83,17 +83,18 @@ const DayScheduleEntry = ({ const seats = range.seats; const isAvailable = range.seats > 0; const setBy = range.exception ? 'exception' : 'plan'; + const startOfDay = getStartOf(range.start, 'day', timeZone); + const startOfNextDay = getStartOf(range.start, 'day', timeZone, 1, 'days'); + const startsAtTheStartOfDay = isSameDate(range.start, startOfDay); + const endsAtTheEndOfDay = isSameDate(range.end, startOfNextDay); + const isFullDay = startsAtTheStartOfDay && endsAtTheEndOfDay; - if (!isAvailable && setBy === 'plan') { + if (!isAvailable && !isFullDay && setBy === 'plan') { // Don't show blocked time-ranges, when it comes from the default schedule. // This is mainly done to make date schedules shorter return null; } - const isFullDay = - isSameDate(range.start, getStartOf(range.start, 'day', timeZone)) && - isSameDate(range.end, getStartOf(range.start, 'day', timeZone, 1, 'days')); - const ex = range.exception; const exception = ex ? ( { ...restOfTransactionType, }, // e.g. stockType + availabilityType: 'multipleSeats', // 'oneSeat', //'multipleSeats', ...restOfListingType, }, ];