fix: AUTO-DRAWn my-sea cards are now clickable to re-open the stage modal — SeaDeal.register(card, posSelector, isLevity) public method populates _seaHand + delegates to SeaDeal's internal _fillSlot so the overlay click handler can resolve _seaHand[pos] for auto-drawn slots (previously short-circuited → silent no-op). AUTO DRAW in my_sea.html now calls register instead of the inline _fillSlot shim — also fixes a dataset.posKey inconsistency (inline stored raw "cover", SeaDeal stores ".sea-pos-cover"; click handler reads SeaDeal's form). User-reported 2026-05-21. TDD — new FT test_auto_drawn_slots_can_reopen_stage_modal_on_click pins the contract

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-20 14:53:05 -04:00
parent 31cb8dfc1d
commit bb44aa326a
3 changed files with 90 additions and 1 deletions

View File

@@ -15,6 +15,14 @@ from apps.epic.models import personal_sig_cards
from apps.lyric.models import User
def _count_filled_slots(picker):
"""Count `.sea-card-slot--filled` elements inside a picker container.
Module-level so multiple test classes can use it without inheriting."""
return len(
picker.find_elements(By.CSS_SELECTOR, ".sea-card-slot--filled")
)
def _seed_gameboard_applets():
"""My Sea + the rest of the gameboard applets so /gameboard/ renders
without missing-applet errors during the applet-side assertions.
@@ -840,6 +848,60 @@ class MySeaCardDrawTest(FunctionalTest):
)
self.assertIn("GATE", action_btn.text.upper())
# ── Test 5b — AUTO DRAW slot click reopens preview modal ────────────────
def test_auto_drawn_slots_can_reopen_stage_modal_on_click(self):
"""Iter-6c bug-fix (user-reported 2026-05-21): cards placed by
AUTO DRAW were silently un-clickable — the inline `_fillSlot`
bypassed `SeaDeal.openStage` so SeaDeal's `_seaHand` dict was
never populated for those slots, and the overlay click handler
short-circuits on `if (!_seaHand[pos]) return;` → no modal.
Reproduce: draw one card manually (sets `_seaHand[lay]`), AUTO
DRAW the rest (sets `_seaHand[lay]` still, but NOT cover/crown
if the bug exists), then click an auto-drawn slot — should
re-open the stage modal w. that card's preview.
Fix landed: `SeaDeal.register(card, posSelector, isLevity)`
public method populates `_seaHand` + delegates to SeaDeal's
internal `_fillSlot` (so `dataset.posKey` stays consistent w.
the manual-FLIP path). AUTO DRAW now calls register, not the
inline shim."""
picker = self._enter_picker_phase()
# Manual draw: lay (first position in SAO order).
self._draw_one(picker, "levity")
self.assertEqual(_count_filled_slots(picker), 1)
# AUTO DRAW the remaining 2 (cover + crown).
action_btn = picker.find_element(By.CSS_SELECTOR, "#id_sea_action_btn")
action_btn.click()
confirm = self.wait_for(
lambda: self.browser.find_element(
By.CSS_SELECTOR, "#id_guard_portal.active .guard-yes"
)
)
confirm.click()
# Wait for hand-complete transition (action btn → GATE VIEW).
self.wait_for(
lambda: self.assertEqual(action_btn.get_attribute("data-state"), "gate-view")
)
# All 3 slots filled.
self.wait_for(lambda: self.assertEqual(_count_filled_slots(picker), 3))
# Click an AUTO-drawn slot (cover — second in SAO draw order, so
# placed by AUTO DRAW). Two-tap pattern: first click focuses,
# second click opens the modal (per SeaDeal's overlay handler).
cover_slot = picker.find_element(
By.CSS_SELECTOR, ".sea-pos-cover .sea-card-slot--filled"
)
cover_slot.click()
cover_slot.click()
# Stage modal must open w. the card preview.
stage = self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_sea_stage")
)
self.wait_for(lambda: self.assertTrue(stage.is_displayed()))
# ── Test 6 ───────────────────────────────────────────────────────────────
def test_del_btn_is_disabled_until_hand_complete(self):