Fix Jauge name centering and add name appearance controls
Center the name+bar block vertically within the Jauge's own box (justify-content:center) so it no longer looks pinned to the top once a name label adds extra content height. Add appearance settings for the name: position (above the bar, or beside it on the left), alignment when above (centered or left-aligned), font family, font size, bold, and italic. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
7e4df3fa3a
commit
3039489e39
@@ -190,6 +190,62 @@ def test_gauge_bar_stays_visible_when_nested_in_a_container_with_a_name(client,
|
||||
assert "min-height:14px" in wrap_style
|
||||
|
||||
|
||||
def test_gauge_name_position_beside_uses_row_layout(client, game):
|
||||
def_id, row_ids = _create_jauge_object_with_rows(client, game)
|
||||
screen_id = _create_screen(client, game)
|
||||
resp = client.post(f"/game/{game}/screens/{screen_id}/elements/add", data={"widget": "jauge"}, follow_redirects=False)
|
||||
jauge_id = int(re.search(r"selected=(\d+)", resp.headers["Location"]).group(1))
|
||||
client.post(f"/game/{game}/elements/{jauge_id}/save", data={
|
||||
"ctrl_definition_id": str(def_id), "ctrl_row_id": str(row_ids["Confiance"]),
|
||||
"ctrl_champ": "value", "ctrl_champ_nom": "name", "ctrl_min": "0", "ctrl_max": "100",
|
||||
"ctrl_nom_position": "cote",
|
||||
})
|
||||
html = client.get(f"/game/{game}/play").data.decode()
|
||||
idx = html.find(f'data-element-id="{jauge_id}"')
|
||||
style = html[html.find('style="', idx):html.find('>', idx)]
|
||||
assert "flex-direction:row" in style
|
||||
|
||||
|
||||
def test_gauge_name_appearance_controls_render_on_the_label(client, game):
|
||||
"""Police, taille, gras et italique du nom doivent se retrouver dans le
|
||||
style inline du libellé — et la taille (contrôle slider sans unité
|
||||
stockée, voir registry.py) ne doit pas finir dupliquée ("18pxpx")."""
|
||||
def_id, row_ids = _create_jauge_object_with_rows(client, game)
|
||||
screen_id = _create_screen(client, game)
|
||||
resp = client.post(f"/game/{game}/screens/{screen_id}/elements/add", data={"widget": "jauge"}, follow_redirects=False)
|
||||
jauge_id = int(re.search(r"selected=(\d+)", resp.headers["Location"]).group(1))
|
||||
client.post(f"/game/{game}/elements/{jauge_id}/save", data={
|
||||
"ctrl_definition_id": str(def_id), "ctrl_row_id": str(row_ids["Confiance"]),
|
||||
"ctrl_champ": "value", "ctrl_champ_nom": "name", "ctrl_min": "0", "ctrl_max": "100",
|
||||
"ctrl_nom_police": "Georgia, serif", "ctrl_nom_taille": "18",
|
||||
"ctrl_nom_gras": "1", "ctrl_nom_italique": "1",
|
||||
})
|
||||
html = client.get(f"/game/{game}/play").data.decode()
|
||||
idx = html.find(">Confiance<")
|
||||
style = html[html.rfind('style="', 0, idx):idx]
|
||||
assert "font-family:Georgia, serif" in style
|
||||
assert "font-size:18px" in style
|
||||
assert "18pxpx" not in style
|
||||
assert "font-weight:700" in style
|
||||
assert "font-style:italic" in style
|
||||
|
||||
|
||||
def test_gauge_name_left_alignment_only_applies_when_above(client, game):
|
||||
def_id, row_ids = _create_jauge_object_with_rows(client, game)
|
||||
screen_id = _create_screen(client, game)
|
||||
resp = client.post(f"/game/{game}/screens/{screen_id}/elements/add", data={"widget": "jauge"}, follow_redirects=False)
|
||||
jauge_id = int(re.search(r"selected=(\d+)", resp.headers["Location"]).group(1))
|
||||
client.post(f"/game/{game}/elements/{jauge_id}/save", data={
|
||||
"ctrl_definition_id": str(def_id), "ctrl_row_id": str(row_ids["Confiance"]),
|
||||
"ctrl_champ": "value", "ctrl_champ_nom": "name", "ctrl_min": "0", "ctrl_max": "100",
|
||||
"ctrl_nom_position": "dessus", "ctrl_nom_alignement": "gauche",
|
||||
})
|
||||
html = client.get(f"/game/{game}/play").data.decode()
|
||||
idx = html.find(">Confiance<")
|
||||
style = html[html.rfind('style="', 0, idx):idx]
|
||||
assert "text-align:left" in style
|
||||
|
||||
|
||||
# ---------- Régression : clics multipliés après un rafraîchissement de
|
||||
# données (bouton +10/-10 relié à une jauge) ----------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user