diff --git a/templates/play.html b/templates/play.html index 17ddef1e..781f3cf1 100644 --- a/templates/play.html +++ b/templates/play.html @@ -163,9 +163,9 @@ -{% if offline_mode %} +{% if offline_mode %} diff --git a/tests/test_collision_rules.py b/tests/test_collision_rules.py index 4102dfb4..103164a7 100644 --- a/tests/test_collision_rules.py +++ b/tests/test_collision_rules.py @@ -357,3 +357,18 @@ def test_build_collision_rule_objects_excludes_the_player(client, tmp_game_slug_ ids = [o["id"] for o in rule_objects] assert enemy_id in ids assert player_id not in ids + + +def test_game_play_online_route_loads_the_scripts_that_apply_a_variable_action(client, tmp_game_slug_cleanup): + """Bug corrigé : compute-operation.js/apply-actions.js (qui portent + forgeApplyVariableActionOffline, appelée par collision-rules-controller.js + pour l'action "Modifier une variable") n'étaient chargés QUE derrière + `{% if offline_mode %}` dans templates/play.html — en aperçu créateur + (/game//play, jamais offline_mode), l'action ne faisait donc + RIEN (fonction absente). Les deux scripts doivent être chargés + inconditionnellement (voir aussi test_export_scorm.py, qui vérifie + qu'ils restent bien présents dans le paquet exporté).""" + slug, _ = _create_jeu2d_game(client, tmp_game_slug_cleanup) + html = client.get(f"/game/{slug}/play").data.decode() + assert 'src="/static/js/play/offline/compute-operation.js"' in html + assert 'src="/static/js/play/offline/apply-actions.js"' in html