PICK SKY: natal wheel polish — house/sign fill fixes, button layout, localStorage FT
- Fix D3 arc coordinate offset (add π/2 to all arc angles — D3 subtracts it internally, causing fills to render 90° CW from label midpoints) - Fix house-12 wrap-around: normalise nextCusp += 360 when it crosses 0°, eliminating the 330° ghost arc that buried house fill/number layers - Draw all house fills before cusp lines + numbers (z-order fix) - SCSS: sign/element fills corrected to rgba(var(--priXx, R, G, B), α) — CSS vars are raw RGB tuples so bare var() in fill was invalid - brighten Stone/Air/Water fallback colours; raise house fill opacities - Button layout: SAVE SKY moves into form column (full-width, pinned bottom); NVM becomes a btn-sm circle anchored on the modal's top-right corner via .natus-modal-wrap (position:relative, outside overflow:hidden modal); entrance animation moved to wrapper so NVM rides the fade+slide - Form fields wrapped in .natus-form-main (scrollable); portrait layout switches form-col to flex-row so form spans most width, SAVE SKY on right - Modal max-height 92→96vh, max-width 840→920px, SVG cap 400→480px - FT: PickSkyLocalStorageTest (2 tests) — form fields restored after NVM and after page refresh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
125
src/functional_tests/test_pick_sky.py
Normal file
125
src/functional_tests/test_pick_sky.py
Normal file
@@ -0,0 +1,125 @@
|
||||
"""Functional tests for the PICK SKY overlay — natal chart entry."""
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from apps.applets.models import Applet
|
||||
from apps.epic.models import GateSlot, Room
|
||||
from apps.lyric.models import User
|
||||
|
||||
from .base import FunctionalTest
|
||||
|
||||
|
||||
def _make_sky_select_room():
|
||||
"""Minimal SKY_SELECT room — just enough for the overlay to render."""
|
||||
email = "founder@test.io"
|
||||
gamer, _ = User.objects.get_or_create(email=email)
|
||||
room = Room.objects.create(name="Sky Test Room", table_status=Room.SKY_SELECT, owner=gamer)
|
||||
# Put the founder in slot 1 so the view recognises them as a participant
|
||||
slot = room.gate_slots.get(slot_number=1)
|
||||
slot.gamer = gamer
|
||||
slot.status = GateSlot.FILLED
|
||||
slot.save()
|
||||
room.gate_status = Room.OPEN
|
||||
room.save()
|
||||
return room, gamer, email
|
||||
|
||||
|
||||
class PickSkyLocalStorageTest(FunctionalTest):
|
||||
"""PICK SKY form fields persist to localStorage."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
Applet.objects.get_or_create(
|
||||
slug="new-game", defaults={"name": "New Game", "context": "gameboard"}
|
||||
)
|
||||
Applet.objects.get_or_create(
|
||||
slug="my-games", defaults={"name": "My Games", "context": "gameboard"}
|
||||
)
|
||||
self.room, self.founder, self.founder_email = _make_sky_select_room()
|
||||
self.room_url = (
|
||||
self.live_server_url + f"/gameboard/room/{self.room.id}/"
|
||||
)
|
||||
|
||||
def _open_overlay(self):
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_pick_sky_btn")
|
||||
)
|
||||
self.browser.execute_script("arguments[0].click()", btn)
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_natus_overlay")
|
||||
)
|
||||
|
||||
def _fill_form(self):
|
||||
"""Set date, lat, lon directly (bypasses Nominatim network call)."""
|
||||
self.browser.execute_script(
|
||||
"document.getElementById('id_nf_date').value = '1990-02-28';"
|
||||
"document.getElementById('id_nf_lat').value = '39.8244';"
|
||||
"document.getElementById('id_nf_lon').value = '-74.9970';"
|
||||
"document.getElementById('id_nf_place').value = 'Lindenwold, NJ';"
|
||||
"document.getElementById('id_nf_tz').value = 'America/New_York';"
|
||||
)
|
||||
# Fire input events so the save listener triggers
|
||||
self.browser.execute_script("""
|
||||
['id_nf_date','id_nf_lat','id_nf_lon','id_nf_place','id_nf_tz'].forEach(id => {
|
||||
const el = document.getElementById(id);
|
||||
el.dispatchEvent(new Event('input', {bubbles: true}));
|
||||
});
|
||||
""")
|
||||
|
||||
def _field_values(self):
|
||||
return self.browser.execute_script("""
|
||||
return {
|
||||
date: document.getElementById('id_nf_date').value,
|
||||
lat: document.getElementById('id_nf_lat').value,
|
||||
lon: document.getElementById('id_nf_lon').value,
|
||||
place: document.getElementById('id_nf_place').value,
|
||||
tz: document.getElementById('id_nf_tz').value,
|
||||
};
|
||||
""")
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T1 — fields survive NVM (close + reopen, same page load) #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_form_fields_repopulated_after_nvm(self):
|
||||
self.create_pre_authenticated_session(self.founder_email)
|
||||
self.browser.get(self.room_url)
|
||||
|
||||
self._open_overlay()
|
||||
self._fill_form()
|
||||
|
||||
# Close via NVM
|
||||
self.browser.find_element(By.ID, "id_natus_cancel").click()
|
||||
|
||||
# Reopen
|
||||
self._open_overlay()
|
||||
|
||||
values = self._field_values()
|
||||
self.assertEqual(values["date"], "1990-02-28")
|
||||
self.assertEqual(values["lat"], "39.8244")
|
||||
self.assertEqual(values["lon"], "-74.9970")
|
||||
self.assertEqual(values["place"], "Lindenwold, NJ")
|
||||
self.assertEqual(values["tz"], "America/New_York")
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T2 — fields survive a page refresh #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_form_fields_repopulated_after_page_refresh(self):
|
||||
self.create_pre_authenticated_session(self.founder_email)
|
||||
self.browser.get(self.room_url)
|
||||
|
||||
self._open_overlay()
|
||||
self._fill_form()
|
||||
|
||||
# Refresh the page
|
||||
self.browser.refresh()
|
||||
|
||||
self._open_overlay()
|
||||
|
||||
values = self._field_values()
|
||||
self.assertEqual(values["date"], "1990-02-28")
|
||||
self.assertEqual(values["lat"], "39.8244")
|
||||
self.assertEqual(values["lon"], "-74.9970")
|
||||
self.assertEqual(values["place"], "Lindenwold, NJ")
|
||||
self.assertEqual(values["tz"], "America/New_York")
|
||||
Reference in New Issue
Block a user