From 5cdbc3195a77fa4e03b028d9b524bfa9d05e5c73 Mon Sep 17 00:00:00 2001 From: Taka Date: Sat, 19 Jun 2021 21:11:35 +1000 Subject: [PATCH] Don't change vehicular smoke dispenser depletion #'s for elite status. --- vasl_templates/webapp/static/snippets.js | 3 ++- .../webapp/tests/test_capabilities.py | 24 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index 150d61d..4b2b790 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -1430,7 +1430,8 @@ function adjust_capabilities_for_elite( capabilities, delta ) for ( var i=0 ; i < capabilities.length ; ++i ) { if ( capabilities[i].indexOf( "" ) !== -1 ) continue ; // nb: ignore raw capabilities (e.g. if the scenario date hasn't been set) - var match = capabilities[i].match( /^(A|M|H|C|D|HE|AP|WP|s|S|sD|sM|sN)([1-9][0-9]?)/ ) ; + // NOTE: Elite status doesn't apply to vehicular smoke dispensers (C8.9). + var match = capabilities[i].match( /^(A|M|H|C|D|HE|AP|WP|S)([1-9][0-9]?)/ ) ; if ( match ) capabilities[i] = match[1] + (parseInt(match[2]) + delta) + capabilities[i].substr(match[1].length+match[2].length) ; } diff --git a/vasl_templates/webapp/tests/test_capabilities.py b/vasl_templates/webapp/tests/test_capabilities.py index 9670827..2e0e051 100644 --- a/vasl_templates/webapp/tests/test_capabilities.py +++ b/vasl_templates/webapp/tests/test_capabilities.py @@ -878,13 +878,13 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements caps = [ c.text for c in find_children(".vo-capability",get_sortable_elem()) ] if expected: assert vo_name.endswith( "\u24ba" ) - expected = [ "A62", "sD8", "CS 6" ] + expected = [ "H9", "s9", "sD7", "CS 5" ] if custom: expected.append( "HE11" ) assert caps == expected else: assert "\u24ba" not in vo_name - expected = [ "A62", "sD7", "CS 6" ] + expected = [ "H8", "s9", "sD7", "CS 5" ] if custom: expected.append( "HE10" ) assert caps == expected @@ -894,13 +894,13 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements caps = [ c.get_attribute("value") for c in find_children("#vo_capabilities-sortable input[type='text']") ] if expected: assert vo_name.endswith( "\u24ba" ) - expected = [ "A62", "sD8", "CS 6" ] + expected = [ "H9", "s9", "sD7", "CS 5" ] if custom: expected.append( "HE11" ) assert caps == expected else: assert "\u24ba" not in vo_name - expected = [ "A62", "sD7", "CS 6" ] + expected = [ "H8", "s9", "sD7", "CS 5" ] if custom: expected.append( "HE10" ) assert caps == expected @@ -908,7 +908,7 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements # load the scenario scenario_data = { "PLAYER_1": "german", - "OB_VEHICLES_1": [ { "name": "PzKpfw VIE" } ], # A6[2] sD7 + "OB_VEHICLES_1": [ { "name": "PSW 233" } ], # H8 s9 sD7 CS 5 } load_scenario( scenario_data ) select_tab( "ob1" ) @@ -921,8 +921,8 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements elem = find_child( "#vo_capabilities-add" ) elem.click() elems = find_children( "#vo_capabilities-sortable input[type='text']" ) - assert len(elems) == 4 - elems[3].send_keys( "HE10" ) + assert len(elems) == 5 + elems[4].send_keys( "HE10" ) click_dialog_button( "OK" ) # make the vehicle elite @@ -939,7 +939,7 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements assert len(saved_scenario["OB_VEHICLES_1"]) == 1 assert saved_scenario["OB_VEHICLES_1"][0]["elite"] assert saved_scenario["OB_VEHICLES_1"][0]["custom_capabilities"] == \ - [ "A62", "sD8", "CS 6", "HE11" ] + [ "H9", "s9", "sD7", "CS 5", "HE11" ] select_menu_option( "new_scenario" ) load_scenario( saved_scenario ) select_tab( "ob1" ) @@ -959,7 +959,7 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements assert len(saved_scenario["OB_VEHICLES_1"]) == 1 assert "elite" not in saved_scenario["OB_VEHICLES_1"][0] assert saved_scenario["OB_VEHICLES_1"][0]["custom_capabilities"] == \ - [ "A62", "sD7", "CS 6", "HE10" ] + [ "H8", "s9", "sD7", "CS 5", "HE10" ] # make the vehicle elite, remove the custom capability ActionChains( webdriver ).double_click( get_sortable_elem() ).perform() @@ -968,8 +968,8 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements elem.click() check_elite2( True, True ) elems = find_children( "#vo_capabilities-sortable li" ) - webdriver.execute_script( "arguments[0].scrollIntoView(true);", elems[3] ) - ActionChains( webdriver ).key_down( Keys.CONTROL ).click( elems[3] ).perform() + webdriver.execute_script( "arguments[0].scrollIntoView(true);", elems[4] ) + ActionChains( webdriver ).key_down( Keys.CONTROL ).click( elems[4] ).perform() ActionChains( webdriver ).key_up( Keys.CONTROL ).perform() click_dialog_button( "OK" ) check_elite( True, False ) @@ -978,7 +978,7 @@ def test_elite( webapp, webdriver ): #pylint: disable=too-many-statements saved_scenario = save_scenario() assert len(saved_scenario["OB_VEHICLES_1"]) == 1 assert saved_scenario["OB_VEHICLES_1"][0]["elite"] - assert saved_scenario["OB_VEHICLES_1"][0]["custom_capabilities"] == [ "A62", "sD8", "CS 6" ] + assert saved_scenario["OB_VEHICLES_1"][0]["custom_capabilities"] == [ "H9", "s9", "sD7", "CS 5" ] select_menu_option( "new_scenario" ) load_scenario( saved_scenario ) select_tab( "ob1" )