room ?seat=N seat-switch: CARTE gamer previews an owned seat's card-stack — data-active-slot + ineligible .fa-ban when it's not the table's turn — TDD
Workstream B of the position-circle tooltips sprint. _role_select_context consumes ?seat=N (threaded from room_view): a multi-seat (CARTE) gamer previews a specific owned seat. The card-stack's active slot becomes that seat; it stays 'eligible' only when the previewed seat is also the table's current turn (lowest unassigned seat), else it renders the ineligible .fa-ban. Strictly additive — a one-seat gamer never passes ?seat, and an unowned/garbage param is ignored, so the normal role-select flow (RoleSelectRenderingTest) is untouched. Tests: CarteSeatSwitchTest.test_switching_seat_loads_that_seats_role_view FT green; 2 new render ITs (seat-param-previews + no-seat-keeps-canonical); RoleSelectRenderingTest still green. [[project-position-circle-tooltips]] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -745,6 +745,23 @@ class PositionTooltipCarteRenderTest(TestCase):
|
||||
chunk = content[idx:idx + 800]
|
||||
self.assertIn("seat=4", chunk)
|
||||
|
||||
def test_seat_param_previews_that_seat_in_card_stack(self):
|
||||
# Un-assigned owned seats → ?seat=4 previews seat 4, which is not the
|
||||
# table's current turn (slot 1) → card-stack ineligible (.fa-ban).
|
||||
for n in range(1, 7):
|
||||
TableSeat.objects.create(room=self.room, gamer=self.viewer, slot_number=n)
|
||||
content = self.client.get(self.room_url + "?seat=4").content.decode()
|
||||
self.assertIn('data-active-slot="4"', content)
|
||||
self.assertIn('data-state="ineligible"', content)
|
||||
|
||||
def test_no_seat_param_keeps_canonical_active_slot(self):
|
||||
for n in range(1, 7):
|
||||
TableSeat.objects.create(room=self.room, gamer=self.viewer, slot_number=n)
|
||||
content = self.client.get(self.room_url).content.decode()
|
||||
# Default: the table's turn is slot 1, and the viewer owns it → eligible.
|
||||
self.assertIn('data-active-slot="1"', content)
|
||||
self.assertIn('data-state="eligible"', content)
|
||||
|
||||
|
||||
class PickRolesViewTest(TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user