From c96deb58149e6b31efd13d45170dc7f70a6109ea Mon Sep 17 00:00:00 2001 From: radhika Date: Thu, 28 Aug 2014 16:03:04 -0400 Subject: [PATCH] 3714: minor updates from review feedback --- .../views/application/report_issue_popup.js.erb | 17 ++++++----------- .../test/integration/report_issue_test.rb | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/workbench/app/views/application/report_issue_popup.js.erb b/apps/workbench/app/views/application/report_issue_popup.js.erb index a1306653bf..6795c091fc 100644 --- a/apps/workbench/app/views/application/report_issue_popup.js.erb +++ b/apps/workbench/app/views/application/report_issue_popup.js.erb @@ -1,21 +1,16 @@ $("#report-issue-modal-window").html("<%= escape_javascript(render partial: 'report_issue_popup') %>"); $("#report-issue-modal-window .modal").modal('show'); -// Disable the submit button until the problem description is entered +// Disable the submit button on modal loading $submit = $('#report-issue-submit'); - -var problem_desc = document.forms["report-issue-form"]["report_issue_text"].value; -if (problem_desc == null || problem_desc == "") { - $submit.attr('disabled', true); -} +$submit.attr('disabled', true); // capture events to enable submit button when applicable $('#report_issue_text').bind('input propertychange', function() { var problem_desc = document.forms["report-issue-form"]["report_issue_text"].value; - - var trigger = false; - if (problem_desc == null || problem_desc == "") { - trigger = true; + if (problem_desc === null || problem_desc === "") { + $submit.attr('disabled', true) + } else { + $submit.removeAttr('disabled'); } - trigger ? $submit.attr('disabled', true) : $submit.removeAttr('disabled'); }); diff --git a/apps/workbench/test/integration/report_issue_test.rb b/apps/workbench/test/integration/report_issue_test.rb index ebedce310c..4bf7d57478 100644 --- a/apps/workbench/test/integration/report_issue_test.rb +++ b/apps/workbench/test/integration/report_issue_test.rb @@ -59,7 +59,7 @@ class ReportIssueTest < ActionDispatch::IntegrationTest # enter a report text and click on report page.find_field('report_issue_text').set 'my test report text' - assert page.has_button?('Send problem report'), 'Send problem report button not enabled after entering text' + assert page.has_button?('Send problem report'), 'Send problem report button not enabled after entering text' click_button 'Send problem report' # ajax success updated button texts and added footer message -- 2.30.2