Author: kake Date: 2012-04-19 19:41:20 +0100 (Thu, 19 Apr 2012) New Revision: 1361
Modified: trunk/lib/OpenGuides.pm trunk/t/94_leaflet.t Log: Fixed capitalisation in map view.
Modified: trunk/lib/OpenGuides.pm =================================================================== --- trunk/lib/OpenGuides.pm 2012-04-19 08:53:11 UTC (rev 1360) +++ trunk/lib/OpenGuides.pm 2012-04-19 18:41:20 UTC (rev 1361) @@ -934,7 +934,8 @@ metadata_value => $cat, ignore_case => 1 ); - my $name = "Category " . ucfirst( $cat ); + my $name = "Category $cat"; + $name =~ s/(\s\w)/\U$1/g; push @criteria, { type => "category", value => $cat, @@ -949,7 +950,8 @@ metadata_value => $loc, ignore_case => 1 ); - my $name = "Locale " . ucfirst( $loc ); + my $name = "Locale $loc"; + $name =~ s/(\s\w)/\U$1/g; push @criteria, { type => "locale", value => $loc,
Modified: trunk/t/94_leaflet.t =================================================================== --- trunk/t/94_leaflet.t 2012-04-19 08:53:11 UTC (rev 1360) +++ trunk/t/94_leaflet.t 2012-04-19 18:41:20 UTC (rev 1361) @@ -11,7 +11,7 @@ "DBD::SQLite could not be used - no database to test with. ($error)"; }
-plan tests => 21; +plan tests => 23;
my $config = OpenGuides::Test->make_basic_config; $config->static_url( "http://example.com/static" ); @@ -130,6 +130,7 @@ latitude => 0, longitude => -0.2, locales => "Zero Land", + categories => "Numerical Nodes", return_output => 1, );
@@ -151,6 +152,16 @@ ok( $node_hash{"Zero Long"}{has_geodata}, "Nodes with zero longitude have has_geodata set." );
+# Check capitalisation. +$output = $guide->show_index( type => "category", value => "numerical nodes", + format => "map", return_output => 1 ); +like( $output, qr/Category\s+Numerical\s+Nodes/, + "Multi-word categories are capitalised properly." ); +$output = $guide->show_index( type => "locale", value => "zero land", + format => "map", return_output => 1 ); +like( $output, qr/Locale\s+Zero\s+Land/, + "Multi-word locales are capitalised properly." ); + # Map shouldn't be displayed if none of the nodes have geodata. %tt_vars = $guide->show_index( type => "locale", value => "Addiscombe", format => "map", return_tt_vars => 1 );
openguides-commits@lists.openguides.org