diff --git a/vasl_templates/webapp/static/main.js b/vasl_templates/webapp/static/main.js index 9fa37f6..476d92a 100644 --- a/vasl_templates/webapp/static/main.js +++ b/vasl_templates/webapp/static/main.js @@ -701,6 +701,15 @@ function on_player_change( player_no ) $( "#ob_ordnance-sortable_" + player_no ).sortable2( "delete-all" ) ; $("input[name='OB_ORDNANCE_WIDTH_"+player_no+"']").val( "" ) ; + // enable/disable the "add vehicle/ordnance" buttons + function update_add_vo_button( vo_type ) { + $( "#ob_"+vo_type+"-add_"+player_no ).button( + gVehicleOrdnanceListings[vo_type][player_nat] ? "enable": "disable" + ) ; + } + update_add_vo_button( "vehicles" ) ; + update_add_vo_button( "ordnance" ) ; + // update the ROAR info panel set_roar_scenario( $("input[name='ROAR_ID']").val() ) ; } diff --git a/vasl_templates/webapp/tests/test_vehicles_ordnance.py b/vasl_templates/webapp/tests/test_vehicles_ordnance.py index 6160021..b95c8ba 100644 --- a/vasl_templates/webapp/tests/test_vehicles_ordnance.py +++ b/vasl_templates/webapp/tests/test_vehicles_ordnance.py @@ -422,19 +422,17 @@ def test_common_vo( webapp, webdriver ): select_tab( "ob1" ) for vo_type in ("vehicles","ordnance"): - # get the vehicles/ordnance - last_warning_marker = set_stored_msg_marker( "_last-warning_" ) + # check if the nationality has any vehicles/ordnance elem = find_child( "#ob_{}-add_1".format( vo_type ) ) - elem.click() - last_warning = get_stored_msg( "_last-warning_" ) if nat in ["thai","indonesian","anzac","burmese","filipino"]: # nb: these are in the BFP extension - assert last_warning.startswith( "There are no" ) + assert not elem.is_enabled() continue elif nat == "kfw-cpva" and vo_type == "vehicles": - assert last_warning.startswith( "There are no" ) + assert not elem.is_enabled() continue - else: - assert last_warning == last_warning_marker + elem.click() + + # get the vehicles/ordnance vo_entries = find_children( "#select-vo .select2-results li" ) vo_entries = [ get_vo_entry(e) for e in vo_entries ] click_dialog_button( "Cancel" )