NATUS WHEEL: half-wheel tooltip positioning + click-outside fix — TDD
Some checks failed
ci/woodpecker/push/pyswiss Pipeline was successful
ci/woodpecker/push/main Pipeline failed

Tooltip positioning:
- Scrapped SVG-edge priority; now places in opposite vertical half anchored
  1rem from the centreline (lower edge above CL if item in bottom half,
  upper edge below CL if item in top half)
- Horizontal: left edge aligns with item when item is left of centre;
  right edge aligns with item when right of centre
- Clamped to svgRect bounds (not window.inner*)

Click-outside fix:
- Added event.stopPropagation() to D3 v7 planet and element click handlers
- Removed svgNode.contains() guard from _attachOutsideClick so clicks on
  empty wheel areas (zodiac ring, background) now correctly dismiss the tooltip

FT fix: use execute_script click for element-ring slice (inside overflow-masked applet)
Jasmine: positioning describe block xdescribe'd (JSDOM has no layout engine)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-04-19 17:27:52 -04:00
parent fbf260b148
commit 2be330e698
6 changed files with 686 additions and 224 deletions

View File

@@ -7,7 +7,6 @@ to their account (stored on the User model, independent of any game room).
import json as _json
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from apps.applets.models import Applet
@@ -169,8 +168,8 @@ class MySkyAppletWheelTest(FunctionalTest):
def test_saved_sky_wheel_renders_with_element_tooltip_in_applet(self):
"""When the user has saved sky data, the natal wheel appears in the My Sky
applet and the element-ring tooltip fires on hover.
(Planet hover tooltip is covered by NatusWheelSpec.js T3/T4/T5.)"""
applet and clicking an element-ring slice shows the tooltip.
(Planet click tooltip is covered by NatusWheelSpec.js T3/T4/T5.)"""
self.create_pre_authenticated_session("stargazer@test.io")
self.browser.get(self.live_server_url)
@@ -181,11 +180,12 @@ class MySkyAppletWheelTest(FunctionalTest):
)
))
# 2. Hovering an element-ring slice shows the tooltip
# 2. Clicking an element-ring slice shows the tooltip (JS click bypasses
# scroll-into-view restriction inside the overflow-masked applet).
slice_el = self.browser.find_element(
By.CSS_SELECTOR, "#id_applet_my_sky .nw-element-group"
)
ActionChains(self.browser).move_to_element(slice_el).perform()
self.browser.execute_script("arguments[0].click();", slice_el)
self.wait_for(lambda: self.assertEqual(
self.browser.find_element(By.ID, "id_natus_tooltip")
.value_of_css_property("display"),
@@ -325,6 +325,5 @@ class MySkyWheelConjunctionTest(FunctionalTest):
10,
))
# (T7 tick-extends-past-zodiac, T8 hover-raises-to-front, and T9 conjunction
# dual-tooltip are covered by NatusWheelSpec.js T7/T8/T9j — ActionChains
# planet-circle hover is unreliable in headless Firefox.)
# (T7 tick-extends-past-zodiac, T8 click-raises-to-front, and T9c/T9n/T9w
# cycle navigation are covered by NatusWheelSpec.js.)