diff options
-rw-r--r-- | .cypress/cypress/integration/regressions.js | 19 | ||||
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311.pm | 1 | ||||
-rw-r--r-- | web/cobrands/sass/_base.scss | 10 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 6 |
5 files changed, 38 insertions, 1 deletions
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js index a0d5b3fc9..c54bc8e9f 100644 --- a/.cypress/cypress/integration/regressions.js +++ b/.cypress/cypress/integration/regressions.js @@ -1,3 +1,10 @@ +// See https://github.com/cypress-io/cypress/issues/761 - Cypress dies if we +// go straight to the next test with an XHR in progress. So visit a 404 page +// to cancel anything in progress. +Cypress.Commands.add('cleanUpXHR', function() { + cy.visit('/404', { failOnStatusCode: false }); +}); + describe('Regression tests', function() { it('Shows the sub-map links after clicking Try again', function() { cy.viewport(480, 800); @@ -5,5 +12,17 @@ describe('Regression tests', function() { cy.get('#map_box').click(200, 200); cy.get('#try_again').click(); cy.get('#sub_map_links').should('be.visible'); + cy.cleanUpXHR(); + }); + it('Does not fade on new pin hover', function() { + cy.visit('/around?pc=BS10+5EE&js=1'); + cy.get('#map_box').click(200, 200); + cy.get('#map_box image').last().trigger('mousemove').should('have.css', 'opacity', '1'); + }); + it('Does not hide the new report pin even if you click really quick', function() { + cy.visit('/around?pc=BS10+5EE&js=1'); + cy.get('#map_box').click(200, 200); + cy.get('#loading-indicator').should('be.hidden'); + cy.get('#map_box image').should('be.visible'); }); }); diff --git a/CHANGELOG.md b/CHANGELOG.md index 08a1d87e8..3d23557fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Add default placeholder to report extra fields. #2027 - Clicking the "Click map" instruction banner now begins a new report #2033 - Homepage postcode input is now marked up as a required input #2037 + - Improved cursor/display of the new report pin. #2038 - Bugfixes: - Stop asset layers obscuring marker layer. #1999 - Don't delete hidden field values when inspecting reports. #1999 @@ -21,6 +22,7 @@ - Fix post-edit issues on admin report edit page. - Truncate dates in Open311 output to the second. #2023 - Fix check for visible sub map links after 'Try again'. + - Stop race condition when making a new report quickly. - Admin improvements: - Inspectors can set non_public status of reports. #1992 - Default start date is shown on the dashboard. @@ -28,6 +30,7 @@ - Don't send sent-report emails to as-body/as-anonymous reports. - Development improvements: - Add HTML email previewer. + - Add CORS header to Open311 output. #2022 - Add some Cypress browser-based testing. * v2.3.1 (12th February 2018) diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index b50728b77..83b9b8202 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -422,6 +422,7 @@ sub get_request : Private { sub format_output : Private { my ( $self, $c, $hashref ) = @_; my $format = $c->stash->{format}; + $c->response->header('Access-Control-Allow-Origin' => '*'); if ('json' eq $format) { $c->res->content_type('application/json; charset=utf-8'); $c->res->body( encode_json($hashref) ); diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index 4e2a2fd5f..d3e96fb5f 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -1649,6 +1649,16 @@ html.js #map .noscript { bottom: 3px !important; #{$right}: 3px; } +.olControlDragFeatureFMSOver { + cursor: move; + cursor: -webkit-grab; + cursor: grab; +} +.olControlDragFeatureFMSActive.olControlDragFeatureFMSOver.olDragDown { + cursor: move; + cursor: -webkit-grabbing; + cursor: grabbing; +} /* Drag is only present in noscript form. XXX Copy from core. */ #drag { diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 0a1c947a0..7d0f9076e 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -96,6 +96,7 @@ $.extend(fixmystreet.utils, { fixmystreet.markers.features[0].move(lonlat); } else { var markers = fixmystreet.maps.markers_list( [ [ lonlat.lat, lonlat.lon, fixmystreet.pin_new_report_colour ] ], false ); + fixmystreet.bbox_strategy.layer.protocol.abort(fixmystreet.bbox_strategy.response); fixmystreet.bbox_strategy.deactivate(); fixmystreet.markers.removeAllFeatures(); fixmystreet.markers.addFeatures( markers ); @@ -125,7 +126,7 @@ $.extend(fixmystreet.utils, { fixmystreet.map.getProjectionObject() ); } - var id = +pin[3]; + var id = pin[3] === undefined ? pin[3] : +pin[3]; var marker_size = (id === window.selected_problem_id) ? selected_size : size; var marker = new OpenLayers.Feature.Vector(loc, { colour: pin[2], @@ -578,6 +579,9 @@ $.extend(fixmystreet.utils, { }); fixmystreet.markers.events.register( 'loadstart', null, fixmystreet.maps.loading_spinner.show); fixmystreet.markers.events.register( 'loadend', null, fixmystreet.maps.loading_spinner.hide); + OpenLayers.Request.XMLHttpRequest.onabort = function() { + fixmystreet.markers.events.triggerEvent("loadend", {response: null}); + }; var markers = fixmystreet.maps.markers_list( fixmystreet.pins, true ); fixmystreet.markers.addFeatures( markers ); |