From a4108c825633182d78b13b41b498ecb1e4513374 Mon Sep 17 00:00:00 2001 From: Taka Date: Sat, 28 Nov 2020 12:18:08 +1100 Subject: [PATCH] Clear a player's description when their nationality is changed. --- vasl_templates/webapp/static/main.js | 5 ++--- vasl_templates/webapp/tests/test_snippets.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/vasl_templates/webapp/static/main.js b/vasl_templates/webapp/static/main.js index 93721ad..ecd7c43 100644 --- a/vasl_templates/webapp/static/main.js +++ b/vasl_templates/webapp/static/main.js @@ -717,11 +717,10 @@ function is_player_ob_empty( player_no ) function on_player_change( player_no ) { - // update the tab label + // update the UI var player_nat = update_ob_tab_header( player_no ) ; - - // show/hide the nationality-specific buttons update_nationality_specific_buttons( player_no ) ; + $( "input[name='PLAYER_" + player_no + "_DESCRIPTION']" ).val( "" ) ; // show/hide the vehicle/ordnance multi-applicable notes controls function update_ma_notes_controls( vo_type ) { diff --git a/vasl_templates/webapp/tests/test_snippets.py b/vasl_templates/webapp/tests/test_snippets.py index 46cdf83..4f9178a 100644 --- a/vasl_templates/webapp/tests/test_snippets.py +++ b/vasl_templates/webapp/tests/test_snippets.py @@ -218,7 +218,7 @@ def test_players_snippets( webapp, webdriver ): _test_snippet( btn, { "PLAYER_1": "british", }, - "player1=[british:British] ; ELR=[1] ; SAN=[2] ; description=[Froggy Army]" \ + "player1=[british:British] ; ELR=[1] ; SAN=[2] ; description=[]" \ " | player2=[british:British] ; ELR=[3] ; SAN=[4] ; description=[Barmy Army]", [ "Both players have the same nationality!" ], )