Make Jauge, Onglets, and every form-field widget real native Bulma elements
- Jauge now renders a real <progress class="progress"> instead of a hand-built pair of absolutely-positioned divs. The bas/haut color interpolation still works, set via Bulma's own --bulma-progress-value-background-color CSS custom property rather than fighting the class. - Onglets' tab strip is now genuine Bulma tabs markup (tabs > ul > li, is-active on the li) instead of custom forgeTabBar/forgeTabBtn classes; forgeShowTab (duplicated in screen_edit.html and play.html) now toggles is-active to match. - Champ texte/email/mot de passe get class="input", Zone de texte gets class="textarea", Case à cocher/Bouton radio's existing <label> wrapper gets class="checkbox"/"radio" (Bulma's own convention — the structure already matched, just needed the class), Liste déroulante is wrapped in Bulma's required <div class="select"> (a bare class on the <select> itself has zero effect in Bulma), Tableau gets class="table is-bordered is-fullwidth" with the per-cell inline borders removed so Bulma's own table styling applies. - Removed the now-dead .forgeTabBar/.forgeTabBtn CSS. Updated tests/test_jauge.py and tests/test_onglets_widget.py assertions to match the new markup (value="X" attribute instead of width:X% inline style, --bulma-progress-value-background-color instead of background-color, forgeShowTab(this) marker instead of the removed forgeTabBtn class) — same behavior, different rendering mechanism. Full suite green (89 passed), verified end to end against the real "test" project via the actual /play route.
This commit is contained in:
+8
-7
@@ -33,7 +33,7 @@ def test_gauge_width_reflects_field_value_without_extra_action(client, game):
|
||||
})
|
||||
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert "width:50.0%" in html
|
||||
assert 'value="50.0"' in html
|
||||
|
||||
|
||||
def test_gauge_updates_after_data_change_with_no_extra_wiring(client, game):
|
||||
@@ -52,7 +52,7 @@ def test_gauge_updates_after_data_change_with_no_extra_wiring(client, game):
|
||||
client.post(f"/game/{game}/objects/{def_id}/data/new", data={"reputation": "90"})
|
||||
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert "width:90.0%" in html
|
||||
assert 'value="90.0"' in html
|
||||
|
||||
|
||||
def test_gauge_color_gradient_shifts_between_low_and_high(client, game):
|
||||
@@ -67,7 +67,7 @@ def test_gauge_color_gradient_shifts_between_low_and_high(client, game):
|
||||
"ctrl_couleur_basse": "#ff0000", "ctrl_couleur_haute": "#00ff00",
|
||||
})
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert "background-color:#00ff00" in html # valeur au max -> couleur "haute" pure
|
||||
assert "--bulma-progress-value-background-color:#00ff00" in html # valeur au max -> couleur "haute" pure
|
||||
|
||||
|
||||
def test_gauge_value_clamped_visually_when_out_of_range(client, game):
|
||||
@@ -82,7 +82,7 @@ def test_gauge_value_clamped_visually_when_out_of_range(client, game):
|
||||
"ctrl_definition_id": str(def_id), "ctrl_champ": "reputation", "ctrl_min": "0", "ctrl_max": "100",
|
||||
})
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert "width:100.0%" in html
|
||||
assert 'value="100.0"' in html
|
||||
|
||||
|
||||
# ---------- Choix de l'enregistrement (plusieurs jauges dans un même objet)
|
||||
@@ -121,7 +121,7 @@ def test_gauge_row_id_distinguishes_between_records_of_the_same_object(client, g
|
||||
"ctrl_champ": "value", "ctrl_min": "0", "ctrl_max": "100",
|
||||
})
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert "width:80.0%" in html
|
||||
assert 'value="80.0"' in html
|
||||
|
||||
|
||||
def test_gauge_without_row_id_falls_back_to_latest_row_no_regression(client, game):
|
||||
@@ -136,7 +136,7 @@ def test_gauge_without_row_id_falls_back_to_latest_row_no_regression(client, gam
|
||||
"ctrl_definition_id": str(def_id), "ctrl_champ": "value", "ctrl_min": "0", "ctrl_max": "100",
|
||||
})
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert "width:80.0%" in html # "Confiance", ajoutée en dernier
|
||||
assert 'value="80.0"' in html # "Confiance", ajoutée en dernier
|
||||
|
||||
|
||||
def test_gauge_name_field_renders_above_the_bar(client, game):
|
||||
@@ -186,7 +186,8 @@ def test_gauge_bar_stays_visible_when_nested_in_a_container_with_a_name(client,
|
||||
html = client.get(f"/game/{game}/play").data.decode()
|
||||
assert ">Confiance<" in html
|
||||
idx = html.find("jaugeBar")
|
||||
wrap_style = html[html.rfind('style="', 0, html.rfind('<div', 0, idx)):idx]
|
||||
div_start = html.rfind('<div', 0, idx)
|
||||
wrap_style = html[div_start:html.find('>', div_start)]
|
||||
assert "min-height:14px" in wrap_style
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ def test_deleting_a_tab_removes_it_and_reselects_the_tabs_widget(client, game):
|
||||
assert f"selected={onglets_id}" in resp.headers["Location"]
|
||||
|
||||
html = client.get(f"/game/{game}/screens/{screen_id}/edit").data.decode()
|
||||
assert html.count("forgeTabBtn") == 1
|
||||
assert html.count("forgeShowTab(this)") == 1
|
||||
|
||||
|
||||
def test_tab_content_holds_a_real_container_children_can_be_added_to(client, game):
|
||||
|
||||
Reference in New Issue
Block a user