Ticket #257: nocgiga.diff

File nocgiga.diff, 1.7 KB (added by bob, 13 years ago)
  • templates/footer.tt

     
    5252    </script>
    5353
    5454    <script type="text/javascript">
    55     var pageTracker = _gat._getTracker("[% CGI.escapeHTML( config.google_analytics_key  ) %]");
     55    var pageTracker = _gat._getTracker("[% config.google_analytics_key %]");
    5656    pageTracker._trackPageview();
    5757    </script>
    5858  [% END %]
  • t/48_google_analytics.t

     
    1010    exit 0;
    1111}
    1212
    13 plan tests => 5;
     13plan tests => 9;
    1414
    1515my ( $config, $guide, $wiki, $cookie, $output );
    1616
     
    5757                              );
    5858like( $output, qr/ga.js/, "does show up if key is provided" );
    5959like( $output, qr/ThisIsNotAKey/, "...correct key" );
     60# Make sure analytics stuff only shows up if we want it to on recent changes
     61# recent changes doesnt use CGI. which we dont need anymore but we should test in case we change our mind again.
     62
     63$config->google_analytics_key( "" );
     64$output = $guide->display_recent_changes( return_output => 1 );
     65unlike( $output, qr/ga.js/, "...also if analytics key is blank" );
     66
     67$config->google_analytics_key( 0 );
     68$output = $guide->display_recent_changes( return_output => 1 );
     69unlike( $output, qr/ga.js/, "...also if analytics key is zero" );
     70
     71$config->google_analytics_key( "ThisIsNotAKey" );
     72$output = $guide->display_recent_changes( return_output => 1 );
     73like( $output, qr/ga.js/, "does show up if key is provided" );
     74like( $output, qr/ThisIsNotAKey/, "...correct key" );