Nouvelle correction demandée sur cette PR : l'onglet générique
« Sources » (avec un <select> interne quand le foyer en a activé
plusieurs) devient une tab à part entière par source activée — au même
niveau que Favoris/Perso/Foyer/Publique, plus transparent qu'un
sélecteur caché dans un sous-menu.
- `RecipeTabs` accepte désormais `sources: SourceView[]` et rend une
tab par source (icône propre à la source si elle en a une, sinon
l'icône générique `SourcesIcon` ; libellé = le nom réel de la
source, pas une clé i18n). Nouveau type `RecipesPageTab` en
`RecipeTab | "source:<key>"`, avec `sourceTabValue`/
`parseSourceTabValue`/`isSourceTab` comme seul point d'assemblage/
lecture de ce format.
- Nouveau hook partagé `useEnabledSources` (déplacé hors de
`RecipeSourcesPanel`, maintenant utilisé par `RecipesPage` ET
`RecipePickerDialog` pour construire leurs tabs).
- `RecipeSourcesPanel` simplifié : `sourceKey` devient une prop requise
(fournie par la tab elle-même) au lieu d'un état interne avec son
propre sélecteur — plus de `<select>`, plus de message « aucune
source activée » (une tab qui n'existe pas ne peut plus être
cliquée). Remonté via `key={sourceKey}` par l'appelant au changement
de tab, même convention que `RecipePickerDialog`/`CalendarPopover`
ailleurs dans l'app.
- Un bug distinct trouvé en écrivant ce changement : passer tel quel
`initialSelection` (dérivé de l'URL) au panneau nouvellement monté
en changeant directement de tab source à tab source aurait fait
prévisualiser l'ancien item contre la nouvelle source. Gardé en ne
transmettant `initialSelection` que lorsqu'il appartient réellement
à `activeSourceKey`.
Aucun changement backend.
Tests :
- Vérifié manuellement en local (foyer avec TheMealDB activé) :
tab dédiée dans /recettes et dans le sélecteur du planning, parcours
d'un item, aperçu unifié, aucune régression console.
- Cypress : `recipe-sources.feature`/`planning.feature` mis à jour
(« I click the button "Sources" » → « ... "TheMealDB" »), scénario
« aucune source activée » réécrit pour vérifier l'absence de tab
plutôt qu'un message dans un onglet qui n'existe plus.
- `pnpm exec tsc -b --force` (web) — propre.
- `pnpm exec biome check` — propre.
- `pnpm --filter web build` — propre.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
83 lines
3.7 KiB
Gherkin
83 lines
3.7 KiB
Gherkin
Feature: Browsing external recipe sources
|
|
As a signed-in user
|
|
I want to browse the recipes available from my household's enabled sources
|
|
So that I can find new recipes to import, or jump straight to ones I already have
|
|
|
|
Background:
|
|
Given I am signed in as "Alice" "Martin"
|
|
And my household id is 1
|
|
And the disliked ingredients list is empty
|
|
And the planning request returns nothing
|
|
|
|
Scenario: Shows no source tab when the household hasn't enabled any
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household's enabled sources are empty
|
|
When I visit "/recettes"
|
|
Then I should not see "TheMealDB"
|
|
|
|
Scenario: Browses an enabled source, distinguishing already-imported items from new ones
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And recipe 2's detail is available
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
Then I should see the source item "Chicken Handi"
|
|
And I should see the source item "Fish Pie"
|
|
And the source item "Chicken Handi" should be marked as already imported
|
|
|
|
When I click the source item "Chicken Handi"
|
|
Then the URL should include "/recettes/2"
|
|
And the recipe detail panel heading should be "Omelette"
|
|
|
|
Scenario: Previews a not-yet-imported item, highlighting its detected techniques
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And previewing TheMealDB item "9999" is available
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
And I click the source item "Fish Pie"
|
|
Then the URL should include "/recettes/sources/theMealDb/9999"
|
|
And the recipe detail panel heading should be "Fish Pie"
|
|
And I should see the highlighted technique "Cuire"
|
|
|
|
Scenario: Deep-links straight to a not-yet-imported item's own page
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And previewing TheMealDB item "9999" is available
|
|
When I visit "/recettes/sources/theMealDb/9999"
|
|
Then the recipe detail panel heading should be "Fish Pie"
|
|
And I should see "Importer cette recette"
|
|
|
|
Scenario: Reviews an import, resolving an unrecognized ingredient before confirming
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And previewing TheMealDB item "9999" is available
|
|
And the ingredient and diet catalog is available for import
|
|
And importing the previewed item will succeed and return id 99
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
And I click the source item "Fish Pie"
|
|
And I click the link "Importer cette recette"
|
|
Then the "recipe-name" field should have the value "Fish Pie"
|
|
And the recipe should include the ingredient "Oignon"
|
|
|
|
When I choose an ingredient for the unresolved line "some mystery paste"
|
|
And I select the ingredient "Sel" from the picker
|
|
Then the unresolved ingredients section should no longer be shown
|
|
And there should be 2 ingredient rows
|
|
|
|
When I select unit "unité" for the first ingredient
|
|
And I fill in the last ingredient's quantity with "1" and unit "unité"
|
|
Then the "Importer" button should not be disabled
|
|
When I click the button "Importer"
|
|
Then the import request should have included ingredient 2 with quantity 1 and unitId 1
|
|
And the URL should include "/recettes/99"
|