aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-08-22 14:47:00 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-08-29 18:12:39 +0100
commit7a8dcd6b60877c37df6961abf6743981966dc30c (patch)
treeac41579c7437c47ee64992839d25f1d3fd3b6649 /t/app/controller
parent7570b9d1d95ec5a5ee58df69feab487be78831aa (diff)
Allow form-disabling per Open311 question answer.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_new_open311.t10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t
index a0f546788..b52e0af18 100644
--- a/t/app/controller/report_new_open311.t
+++ b/t/app/controller/report_new_open311.t
@@ -293,6 +293,9 @@ subtest "Category extras includes form disabling string" => sub {
MAPIT_URL => 'http://mapit.uk/',
}, sub {
$contact4->push_extra_fields({ description => 'Please ring us!', code => 'ring', variable => 'false', order => '0', disable_form => 'true' });
+ $contact4->push_extra_fields({ datatype_description => 'Please please ring', description => 'Is it dangerous?', code => 'dangerous',
+ variable => 'true', order => '0', values => [ { name => 'Yes', key => 'yes', disable => 1 }, { name => 'No', key => 'no' } ]
+ });
$contact4->update;
for (
{ url => '/report/new/ajax?' },
@@ -300,7 +303,12 @@ subtest "Category extras includes form disabling string" => sub {
) {
my $json = $mech->get_ok_json($_->{url} . '&latitude=55.952055&longitude=-3.189579');
my $output = $json->{by_category} ? $json->{by_category}{Pothole}{disable_form} : $json->{disable_form};
- is $output, 'Please ring us!';
+ is_deeply $output, {
+ all => 'Please ring us!',
+ message => 'Please please ring',
+ code => 'dangerous',
+ answers => [ 'yes' ],
+ };
}
};
};