aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cypress/cypress/fixtures/trees.json2
-rw-r--r--.cypress/cypress/integration/northamptonshire.js8
-rw-r--r--.cypress/cypress/integration/regressions.js17
-rw-r--r--CHANGELOG.md1
-rwxr-xr-xbin/fixmystreet.com/fixture6
-rw-r--r--t/Mock/MapIt.pm5
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js10
7 files changed, 37 insertions, 12 deletions
diff --git a/.cypress/cypress/fixtures/trees.json b/.cypress/cypress/fixtures/trees.json
index c965614f7..f3808c912 100644
--- a/.cypress/cypress/fixtures/trees.json
+++ b/.cypress/cypress/fixtures/trees.json
@@ -7,7 +7,7 @@
"geometry": {
"type": "Point",
"coordinates": [
- 99073,
+ -99073,
6843328
]
},
diff --git a/.cypress/cypress/integration/northamptonshire.js b/.cypress/cypress/integration/northamptonshire.js
index 082f03de1..c3a548843 100644
--- a/.cypress/cypress/integration/northamptonshire.js
+++ b/.cypress/cypress/integration/northamptonshire.js
@@ -8,7 +8,7 @@ it('prevents clicking unless asset selected', function() {
cy.fixture('trees.json');
cy.fixture('trees_none.json');
cy.route('**/render-layer/**', 'fixture:trees_none.json').as('empty-trees-layer');
- cy.route('**/16463/10787**', 'fixture:trees.json').as('trees-layer');
+ cy.route('**/16301/10787**', 'fixture:trees.json').as('trees-layer');
cy.route('/report/new/ajax*').as('report-ajax');
cy.visit('http://northamptonshire.localhost:3001/');
cy.get('[name=pc]').type('NN1 1NS');
@@ -30,7 +30,7 @@ it('selecting an asset allows a report', function() {
cy.fixture('trees.json');
cy.fixture('trees_none.json');
cy.route('**/render-layer/**', 'fixture:trees_none.json').as('empty-trees-layer');
- cy.route('**/16463/10787**', 'fixture:trees.json').as('trees-layer');
+ cy.route('**/16301/10787**', 'fixture:trees.json').as('trees-layer');
cy.route('/report/new/ajax*').as('report-ajax');
cy.visit('http://northamptonshire.localhost:3001/');
cy.get('[name=pc]').type('NN1 2NS');
@@ -52,8 +52,8 @@ it('detects multiple assets at same location', function() {
cy.fixture('trees.json');
cy.fixture('trees_none.json');
cy.route('**/render-layer/**', 'fixture:trees_none.json').as('empty-trees-layer');
- cy.route('**/16463/10787**', 'fixture:trees.json').as('trees-layer');
- cy.route('**/16463/10788**', 'fixture:trees.json').as('trees-layer2');
+ cy.route('**/16301/10787**', 'fixture:trees.json').as('trees-layer');
+ cy.route('**/16301/10788**', 'fixture:trees.json').as('trees-layer2');
cy.route('/report/new/ajax*').as('report-ajax');
cy.visit('http://northamptonshire.localhost:3001/');
cy.get('[name=pc]').type('NN1 2NS');
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js
index af6a1d73d..7bdd8f6fe 100644
--- a/.cypress/cypress/integration/regressions.js
+++ b/.cypress/cypress/integration/regressions.js
@@ -54,4 +54,21 @@ describe('Regression tests', function() {
cy.get('.content').should('not.contain', 'toddler');
});
+ it.only('has the correct send-to text at all times', function() {
+ cy.server();
+ cy.route('/report/new/ajax*').as('report-ajax');
+ cy.visit('/');
+ cy.get('[name=pc]').type('NN1 1NS');
+ cy.get('[name=pc]').parents('form').submit();
+
+ cy.get('#map_box').click();
+ cy.wait('@report-ajax');
+ cy.get('[id=category_group]').select('Graffiti');
+ cy.contains(/These will be sent to Northampton Borough Council and also/);
+
+ cy.get('#map_box').click(200, 200);
+ cy.wait('@report-ajax');
+ cy.contains(/These will be sent to Northampton Borough Council and also/);
+ });
+
});
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9cfc0e5f9..7052ebc36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
- Prevent creation of two templates with same title.
- Fix bug going between report/new pages client side
- Don't include private reports when searching by ref from front page.
+ - Set fixmystreet.bodies sooner client-side, for two-tier locations.
- Development improvements:
- Upgrade the underlying framework and a number of other packages.
- Add feature cobrand helper function.
diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture
index 4a5bd3aed..35e4e819c 100755
--- a/bin/fixmystreet.com/fixture
+++ b/bin/fixmystreet.com/fixture
@@ -98,6 +98,12 @@ if ($opt->test_fixtures) {
name => 'Northamptonshire County Council',
});
say "Created body " . $ncc->name . " for MapIt area ID 2234, categories Fallen Tree";
+ $ncc = FixMyStreet::DB::Factory::Body->find_or_create({
+ area_id => 2397,
+ categories => [ 'Graffiti' ],
+ name => 'Northampton Borough Council',
+ });
+ say "Created body " . $ncc->name . " for MapIt area ID 2397, categories Graffiti";
}
FixMyStreet::DB::Factory::ResponseTemplate->create({
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index c255c916a..1cc3fb23c 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -37,8 +37,9 @@ my @PLACES = (
[ 'LE15 0GJ', 52.670447, -0.727877, 2600, 'Rutland County Council', 'CTY'],
[ 'BR1 3UH', 51.4021, 0.01578, 2482, 'Bromley Council', 'LBO' ],
[ 'BR1 3UH', 51.402096, 0.015784, 2482, 'Bromley Council', 'LBO' ],
- [ 'NN1 1NS', 52.236251, 0.892052, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
- [ 'NN1 2NS', 52.238301, 0.889992, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
+ [ 'NN1 1NS', 52.236251, -0.892052, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
+ [ 'NN1 2NS', 52.238301, -0.889992, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
+ [ '?', 52.238827, -0.894970, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
[ 'TW7 5JN', 51.482286, -0.328163, 2483, 'Hounslow Borough Council', 'LBO' ],
[ '?', 50.78301, -0.646929 ],
[ 'TA1 1QP', 51.023569, -3.099055, 2239, 'Somerset County Council', 'CTY', 2429, 'Taunton Deane Borough Council', 'DIS' ],
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 11e9045ab..d71217ad0 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -1196,6 +1196,11 @@ fixmystreet.fetch_reporting_data = function() {
fixmystreet.reporting_data = data;
+ fixmystreet.bodies = data.bodies || [];
+ if (fixmystreet.body_overrides) {
+ fixmystreet.body_overrides.clear();
+ }
+
fixmystreet.update_councils_text(data);
$('#js-top-message').html(data.top_message || '');
@@ -1218,11 +1223,6 @@ fixmystreet.fetch_reporting_data = function() {
lb.before(data.extra_name_info);
}
- fixmystreet.bodies = data.bodies || [];
- if (fixmystreet.body_overrides) {
- fixmystreet.body_overrides.clear();
- }
-
if (data.contribute_as) {
var $select = $('.js-contribute-as');
if (!$select.data('original')) {