Skip to content

Commit

Permalink
fix: same comparison in transport integration
Browse files Browse the repository at this point in the history
  • Loading branch information
desoindx committed Dec 12, 2024
1 parent deb8f48 commit 2703aea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/shareable/overScreens/TransportComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ const TransportComparison = ({
if (!equivalent1 && !equivalent2) {
setComparison([filteredEquivalents[0].slug, filteredEquivalents[1].slug])
} else if (!equivalent1) {
setComparison([filteredEquivalents[0].slug, comparison[1]])
const newComparison = filteredEquivalents[0].slug
setComparison([newComparison === comparison[1] ? filteredEquivalents[1].slug : newComparison, comparison[1]])
} else if (!equivalent2) {
setComparison([comparison[0], filteredEquivalents[1].slug])
const newComparison = filteredEquivalents[0].slug
setComparison([comparison[0], newComparison === comparison[0] ? filteredEquivalents[1].slug : newComparison])
}
}, [equivalent1, equivalent2])

Expand Down
2 changes: 1 addition & 1 deletion teste/distance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const distanceTest = async (page: Page | FrameLocator, prod?: boolean) =>
await page.locator('span').filter({ hasText: /^TER$/ }).nth(2).click()
await page.getByLabel('Intégrer').getByText('Covoiturage thermique', { exact: true }).click()
await expect(page.getByTestId('clipboard-box')).toHaveText(
`<script name="impact-co2" src="${prod ? 'https://impactco2.fr' : 'http://localhost:3000'}/iframe.js" data-type="transport/itineraire" data-search="?theme=default&language=fr&tabs=distance&km=1000&defaultMode=comparison&comparison=voiturethermique,avion&modes=avion,intercites,voiturethermique,voitureelectrique+1,voitureelectrique,autocar,velo,veloelectrique,busthermique,tramway,metro,scooter,moto,rer,buselectrique,trottinette,busgnv"></script>`
`<script name="impact-co2" src="${prod ? 'https://impactco2.fr' : 'http://localhost:3000'}/iframe.js" data-type="transport/itineraire" data-search="?theme=default&language=fr&tabs=distance&km=1000&defaultMode=comparison&comparison=voiturethermique,autocar&modes=avion,intercites,voiturethermique,voitureelectrique+1,voitureelectrique,autocar,velo,veloelectrique,busthermique,tramway,metro,scooter,moto,rer,buselectrique,trottinette,busgnv"></script>`
)
await page.getByTestId('text-select-comparison-1').selectOption('velo')
await page.getByTestId('text-select-comparison-2').selectOption('moto')
Expand Down

0 comments on commit 2703aea

Please sign in to comment.