Skip to content

Commit

Permalink
(PC-30848)[PRO] fix: Check all offers when clicking on Tout Sélection…
Browse files Browse the repository at this point in the history
…ner in the indifv offers tables even if they are isEditable: true
  • Loading branch information
gmeigniez-pass committed Jul 15, 2024
1 parent 9495baa commit 248bf82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions pro/src/screens/Offers/Offers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ export const Offers = ({

const areAllIndividualOffersSelected =
selectedIndividualOffers.length > 0 &&
selectedIndividualOffers.length ===
offers.filter((offer) => offer.isEditable).length
selectedIndividualOffers.length === offers.length

function clearSelectedOfferIds() {
setSelectedCollectiveOffers([])
Expand All @@ -152,11 +151,7 @@ export const Offers = ({
: offers.filter((offer) => offer.isEditable)
)
} else {
setSelectedIndividualOffers(
areAllIndividualOffersSelected
? []
: offers.filter((offer) => offer.isEditable)
)
setSelectedIndividualOffers(areAllIndividualOffersSelected ? [] : offers)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pro/src/screens/Offers/__specs__/Offers.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ describe('screen Offers', () => {

expect(firstOfferCheckbox).toBeChecked()
expect(secondOfferCheckbox).toBeChecked()
expect(thirdOfferCheckbox).not.toBeChecked()
expect(fourthOfferCheckbox).not.toBeChecked()
expect(thirdOfferCheckbox).toBeChecked()
expect(fourthOfferCheckbox).toBeChecked()

await userEvent.click(screen.getByLabelText('Tout désélectionner'))

Expand Down

0 comments on commit 248bf82

Please sign in to comment.