From 7263e2c8b5e3a5068f97135a7de0913977279a3b Mon Sep 17 00:00:00 2001 From: Moray Jones Date: Wed, 27 Nov 2024 17:28:47 +0000 Subject: [PATCH] fixup! [Surrey] Continue button should not be visible when disabled --- .cypress/cypress/integration/surrey.js | 4 +++- web/cobrands/fixmystreet/assets.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.cypress/cypress/integration/surrey.js b/.cypress/cypress/integration/surrey.js index 06e72ca9c5..8d8312c2b8 100644 --- a/.cypress/cypress/integration/surrey.js +++ b/.cypress/cypress/integration/surrey.js @@ -15,11 +15,13 @@ describe('Reporting not on a road', function() { cy.pickCategory('Abandoned vehicles'); cy.contains('You cannot send Surrey County Council a report'); cy.get('#map_sidebar').scrollTo('bottom'); - cy.get('.js-reporting-page--next:hidden').should('be.disabled'); + cy.get('.js-reporting-page--next').should('be.disabled'); + cy.get('.js-reporting-page--next').should('not.be.visible'); cy.pickCategory('Flooding inside a building'); cy.contains('You cannot send Surrey County Council a report').should('not.be.visible'); cy.get('#map_sidebar').scrollTo('bottom'); cy.get('.js-reporting-page--next:visible').should('not.be.disabled'); + cy.get('.js-reporting-page--next').should('be.visible'); }); }); diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index d7f195bfeb..5b99ed8a0b 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -1535,7 +1535,7 @@ fixmystreet.message_controller = (function() { if ( $('#js-roads-responsibility').is(':visible') || $('.js-mobile-not-an-asset').length ) { return; } - if (fixmystreet.cobrand === 'surrey') { + if (hide_continue_button()) { $('.js-reporting-page--next').show(); } $('.js-reporting-page--next').prop('disabled', false); @@ -1549,12 +1549,19 @@ fixmystreet.message_controller = (function() { $("#mob_ok, #toggle-fullscreen").addClass('hidden-js'); } else { $('.js-reporting-page--next').prop('disabled', true); - if (fixmystreet.cobrand === 'surrey') { + if (hide_continue_button()) { $('.js-reporting-page--next').hide(); } } } + function hide_continue_button() { + var cobrands_to_hide = ['surrey', 'hart']; + if (cobrands_to_hide.indexOf(fixmystreet.cobrand) !== -1) { + return 1; + } + } + // This hides the responsibility message, and (unless a // stopper message or dupes are shown) reenables the report form function responsibility_off(layer, type) {