feat(game): add Submit & Create Session button to add-game form

Closes #31
This commit is contained in:
2026-06-20 19:49:00 +02:00
parent fe3e070669
commit e7a0eb7dca
2 changed files with 36 additions and 6 deletions
+17
View File
@@ -128,12 +128,29 @@ class RenderedPagesTest(TestCase):
self.assertIn("dist/add_game.js", html)
self.assertIn("submit_and_redirect", html)
self.assertIn("Submit & Create Purchase", html) # & correctly escaped
self.assertIn("submit_and_create_session", html)
self.assertIn("Submit & Create Session", html) # & correctly escaped
# Fields self-style: label + control carry their own classes (no #add-form
# / form CSS in input.css).
self.assertIn("mb-2.5 text-sm font-medium text-heading", html) # _LABEL_CLASS
self.assertIn("bg-neutral-secondary-medium", html) # INPUT_CLASS surface
self.assertNoEscapedTags(html)
def test_add_game_submit_and_create_session_redirects(self):
response = self.client.post(
reverse("games:add_game"),
{
"name": "New Session Game",
"status": "u",
"submit_and_create_session": "",
},
)
game = Game.objects.get(name="New Session Game")
self.assertRedirects(
response,
reverse("games:add_session_for_game", kwargs={"game_id": game.id}),
)
def test_form_errors_render_with_component_class(self):
"""Invalid submits re-render field errors via FormFields' own class, not
Django's .errorlist (which no longer exists in the CSS)."""