From 97c017aac4efe1e97e87008fea79a7425c1d2320 Mon Sep 17 00:00:00 2001 From: Jake Benilov Date: Thu, 28 Aug 2014 21:39:57 +0000 Subject: [PATCH 1/2] Fixes to report-a-problem confirmation and errors The markup for the report-a-problem form was changed in https://github.com/alphagov/static/pull/441 but the confirmation and error javascript code wasn't. This means that those elements are misaligned and this change fixes that problem. --- app/assets/javascripts/report-a-problem.js | 4 ++-- spec/javascripts/report-a-problem-spec.js | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/report-a-problem.js b/app/assets/javascripts/report-a-problem.js index fc8d611a6..9ce629971 100644 --- a/app/assets/javascripts/report-a-problem.js +++ b/app/assets/javascripts/report-a-problem.js @@ -3,7 +3,7 @@ var ReportAProblem = { var response = "

Sorry, we're unable to receive your message right now.

" + "

We have other ways for you to provide feedback on the " + "support page.

" - $('.report-a-problem-container').html(response); + $('.report-a-problem-content').html(response); }, promptUserToEnterValidData: function() { @@ -20,7 +20,7 @@ var ReportAProblem = { }, showConfirmation: function(data) { - $('.report-a-problem-container').html(data.message); + $('.report-a-problem-content').html(data.message); }, submit: function() { diff --git a/spec/javascripts/report-a-problem-spec.js b/spec/javascripts/report-a-problem-spec.js index cd0708a94..fcc194fcb 100644 --- a/spec/javascripts/report-a-problem-spec.js +++ b/spec/javascripts/report-a-problem-spec.js @@ -1,5 +1,9 @@ describe("form submission for reporting a problem", function () { - var FORM_TEXT = '
'; + var FORM_TEXT = '
' + + '
' + + '
' + + '
' + + '
'; var form; beforeEach(function() { @@ -27,7 +31,7 @@ describe("form submission for reporting a problem", function () { form.triggerHandler('submit'); expect(form).toBeHidden(); - expect($('.report-a-problem-container').html()).toEqual('great success!'); + expect($('.report-a-problem-content').html()).toEqual('great success!'); }); }); @@ -53,7 +57,7 @@ describe("form submission for reporting a problem", function () { form.triggerHandler('submit'); expect(form).not.toBeVisible(); - expect($('.report-a-problem-container').html()).toContain("Sorry, we're unable to receive your message"); + expect($('.report-a-problem-content').html()).toContain("Sorry, we're unable to receive your message"); }); }); }); From e9e4b2759f408bafaa8eada5ba5a3d292f26a849 Mon Sep 17 00:00:00 2001 From: Jake Benilov Date: Thu, 28 Aug 2014 22:44:30 +0100 Subject: [PATCH 2/2] Report-a-problem: update error message copy The support page was renamed a while ago to the contact page. --- app/assets/javascripts/report-a-problem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/report-a-problem.js b/app/assets/javascripts/report-a-problem.js index 9ce629971..ea363fddc 100644 --- a/app/assets/javascripts/report-a-problem.js +++ b/app/assets/javascripts/report-a-problem.js @@ -2,7 +2,7 @@ var ReportAProblem = { showErrorMessage: function (jqXHR) { var response = "

Sorry, we're unable to receive your message right now.

" + "

We have other ways for you to provide feedback on the " + - "support page.

" + "contact page.

" $('.report-a-problem-content').html(response); },