Fixed Chapter H URL's for derived nationalities.

master
Pacman Ghost 3 years ago
parent 82f383d6c4
commit 3a8385023b
  1. 6
      vasl_templates/webapp/static/snippets.js
  2. 9
      vasl_templates/webapp/tests/fixtures/data/default-template-pack/nationalities.json
  3. 8
      vasl_templates/webapp/tests/fixtures/data/ordnance/chinese.json
  4. 1
      vasl_templates/webapp/tests/fixtures/data/ordnance/chinese~gmd.json
  5. 8
      vasl_templates/webapp/tests/fixtures/data/vehicles/chinese.json
  6. 1
      vasl_templates/webapp/tests/fixtures/data/vehicles/chinese~gmd.json
  7. BIN
      vasl_templates/webapp/tests/fixtures/vo-notes/chinese/ordnance/1.png
  8. BIN
      vasl_templates/webapp/tests/fixtures/vo-notes/chinese/vehicles/1.png
  9. 33
      vasl_templates/webapp/tests/test_vo_notes.py

@ -580,7 +580,11 @@ function get_vo_note( vo_type, nat, key )
var vo_note = gVehicleOrdnanceNotes[ vo_type ][ nat ][ key ] ;
// FUDGE! We need to detect between a full HTML note and an image-based one.
// This is not great, but it'll do... :-/
if ( vo_note.substr( 0, nat.length+1 ) === nat+"/" )
var nat2 = nat ;
var pos = nat2.indexOf( "~" ) ;
if ( pos > 0 )
nat2 = nat2.substring( 0, pos ) ;
if ( vo_note.substr( 0, nat2.length+1 ) === nat2+"/" )
return make_app_url( "/" + vo_type + "/" + nat + "/note/" + key, true ) ;
else
return vo_note ;

@ -24,6 +24,15 @@
"ob_colors": [ "OBCOL:british~canadian","OBCOL2:british~canadian", "OBCOL-BORDER:british~canadian" ]
},
"chinese": {
"display_name": "Chinese",
"ob_colors": [ "OBCOL:chinese","OBCOL2:chinese", "OBCOL-BORDER:chinese" ]
},
"chinese~gmd": {
"display_name": "Chinese GMD",
"ob_colors": [ "OBCOL:chinese~gmd","OBCOL2:chinese~gmd", "OBCOL-BORDER:chinese~gmd" ]
},
"french": {
"display_name": "French",
"ob_colors": [ "OBCOL:french","OBCOL2:french", "OBCOL-BORDER:french" ]

@ -0,0 +1,8 @@
[
{ "name": "a chinese ordnance",
"note_number": "1",
"id": "ch/o:001"
}
]

@ -0,0 +1,8 @@
[
{ "name": "a chinese vehicle",
"note_number": "1",
"id": "ch/v:001"
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -138,6 +138,39 @@ def test_ma_html_notes( webapp, webdriver ):
# ---------------------------------------------------------------------
def test_derived_nationalities( webapp, webdriver ):
"""Test generating V/O notes for derived nationalities."""
# initialize
webapp.control_tests.set_vo_notes_dir( "{TEST}" )
init_webapp( webapp, webdriver, scenario_persistence=1 )
load_scenario( {
"PLAYER_1": "chinese",
"OB_VEHICLES_1": [ { "name": "a chinese vehicle" } ],
"OB_ORDNANCE_1": [ { "name": "a chinese ordnance" } ],
"PLAYER_2": "chinese~gmd",
"OB_VEHICLES_2": [ { "name": "a chinese vehicle" } ],
"OB_ORDNANCE_2": [ { "name": "a chinese ordnance" } ],
} )
# check the snippets for the base nationality
_check_vo_snippets( 1, "vehicles", [
( "a chinese vehicle", "vehicles/chinese/note/1" )
] )
_check_vo_snippets( 1, "ordnance", [
( "a chinese ordnance", "ordnance/chinese/note/1" )
] )
# check the snippets for the derived nationality
_check_vo_snippets( 2, "vehicles", [
( "a chinese vehicle", "vehicles/chinese~gmd/note/1" )
] )
_check_vo_snippets( 2, "ordnance", [
( "a chinese ordnance", "ordnance/chinese~gmd/note/1" )
] )
# ---------------------------------------------------------------------
def test_common_vo_notes( webapp, webdriver ):
"""Test handling of Allied/Axis Minor common vehicles/ordnance."""

Loading…
Cancel
Save