Add tabs for all, own and favourite recipes
- Tabs "Alle", "Eigene Rezepte", "Favoriten" above the recipe list; search and tag filters stay within the active tab - Menu link to own recipes; empty states per tab - Fix recipe card images rendering portrait instead of 4:3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c76fd119cf
commit
23adb882bd
@@ -204,3 +204,28 @@ def test_imported_draft_defaults_to_public(user_client, settings):
|
||||
def test_private_can_still_be_chosen(user_client):
|
||||
user_client.post(reverse("recipes:create"), form_data(visibility="private"))
|
||||
assert Recipe.objects.get().visibility == "private"
|
||||
|
||||
|
||||
def test_tabs_and_own_recipes_tab(user_client, user, other_user):
|
||||
make_recipe(user, title="Meins", visibility=Recipe.Visibility.PRIVATE)
|
||||
make_recipe(other_user, title="Deins")
|
||||
response = user_client.get(reverse("recipes:list"), {"ansicht": "meine"})
|
||||
html = response.content.decode()
|
||||
assert "Eigene Rezepte" in html and 'aria-current="page">Eigene Rezepte' in html
|
||||
assert [r.title for r in response.context["page"].object_list] == ["Meins"]
|
||||
all_titles = {r.title for r in user_client.get(reverse("recipes:list")).context["page"].object_list}
|
||||
assert all_titles == {"Meins", "Deins"}
|
||||
|
||||
|
||||
def test_search_stays_in_own_tab(user_client, user, other_user):
|
||||
make_recipe(user, title="Linsensuppe")
|
||||
make_recipe(other_user, title="Linsensalat")
|
||||
response = user_client.get(reverse("recipes:list"), {"ansicht": "meine", "q": "linsen"})
|
||||
assert [r.title for r in response.context["page"].object_list] == ["Linsensuppe"]
|
||||
assert '<input type="hidden" name="ansicht" value="meine">' in response.content.decode()
|
||||
|
||||
|
||||
def test_own_tab_empty_state(user_client, other_user):
|
||||
make_recipe(other_user, title="Deins")
|
||||
html = user_client.get(reverse("recipes:list"), {"ansicht": "meine"}).content.decode()
|
||||
assert "noch keine eigenen Rezepte" in html and "Deins" not in html
|
||||
|
||||
Reference in New Issue
Block a user