diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 2 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index d3a4500c6..72d6ac62b 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -235,7 +235,7 @@ the map. sub ajax : Path('/ajax') { my ( $self, $c ) = @_; - $c->res->content_type('text/javascript; charset=utf-8'); + $c->res->content_type('application/json; charset=utf-8'); unless ( $c->req->param('bbox') ) { $c->res->status(404); diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index fa188210a..9158231df 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -516,6 +516,7 @@ subtest "test report creation for a user who is signing in as they report" => su }; #### test report creation for user with account and logged in +my ($saved_lat, $saved_lon); foreach my $test ( { category => 'Trees', council => 2326 }, { category => 'Potholes', council => 2226 }, @@ -564,7 +565,7 @@ foreach my $test ( $mech->submit_form_ok( { with_fields => { - title => 'Test Report', + title => "Test Report at caf\xc3\xa9", detail => 'Test report details.', photo => '', name => 'Joe Bloggs', @@ -604,12 +605,26 @@ foreach my $test ( # user is still logged in $mech->logged_in_ok; + # Test that AJAX pages return the right data + $mech->get_ok( + '/ajax?bbox=' . ($report->longitude - 0.01) . ',' . ($report->latitude - 0.01) + . ',' . ($report->longitude + 0.01) . ',' . ($report->latitude + 0.01) + ); + $mech->content_contains( "Test Report at caf\xc3\xa9" ); + $saved_lat = $report->latitude; + $saved_lon = $report->longitude; + # cleanup $mech->delete_user($user); }; } +$contact2->category( "Pothol\xe9s" ); +$contact2->update; +$mech->get_ok( '/report/new/ajax?latitude=' . $saved_lat . '&longitude=' . $saved_lon ); +$mech->content_contains( "Pothol\xc3\xa9s" ); + #### test uploading an image #### test completing a partial report (eq flickr upload) |