aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/report_display.t73
-rw-r--r--t/app/model/problem.t96
2 files changed, 120 insertions, 49 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 746f68cf6..d20774560 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -119,55 +119,6 @@ subtest "test a good report" => sub {
is $update_form->value($_), $fields{$_}, "$_ value" for keys %fields;
};
-for my $test (
- {
- state => 'confirmed',
- display => 1,
- },
- {
- state => 'investigating',
- display => 1,
- },
- {
- state => 'planned',
- display => 1,
- },
- {
- state => 'in progress',
- display => 1,
- },
- {
- state => 'fixed',
- display => 0,
- },
- {
- state => 'fixed - council',
- display => 0,
- },
- {
- state => 'fixed - user',
- display => 0,
- },
- {
- state => 'will not fix',
- display => 0,
- },
-) {
- subtest "check fixed checkbox display for state $test->{state}" => sub {
- $report->state( $test->{state} );
- $report->update;
- $mech->get_ok("/report/$report_id");
-
- my $update_form = $mech->form_name('updateForm');
-
- if ( $test->{display} ) {
- ok defined $update_form->find_input('#form_fixed', 'checkbox'), "fixed checkbox display";
- } else {
- is $update_form->find_input('#form_fixed', 'checkbox'), undef, "fixed checkbox display";
- }
- };
-}
-
foreach my $meta (
{
anonymous => 'f',
@@ -284,6 +235,30 @@ for my $test (
banner_text => 'This problem has been fixed.',
fixed => 1
},
+ {
+ description => 'user fixed report',
+ date => DateTime->now,
+ state => 'fixed - user',
+ banner_id => 'fixed',
+ banner_text => 'This problem has been fixed.',
+ fixed => 1
+ },
+ {
+ description => 'council fixed report',
+ date => DateTime->now,
+ state => 'fixed - council',
+ banner_id => 'fixed',
+ banner_text => 'This problem has been fixed.',
+ fixed => 1
+ },
+ {
+ description => 'closed report',
+ date => DateTime->now,
+ state => 'will not fix',
+ banner_id => '',
+ banner_text => '',
+ fixed => 0
+ },
) {
subtest "banner for $test->{description}" => sub {
$report->confirmed( $test->{date}->ymd . ' ' . $test->{date}->hms );
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 5a5eb2520..38ddc1857 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -196,4 +196,100 @@ for my $test (
};
}
+for my $test (
+ {
+ state => 'unconfirmed',
+ is_fixed => 0,
+ },
+ {
+ state => 'confirmed',
+ is_fixed => 0,
+ },
+ {
+ state => 'investigating',
+ is_fixed => 0,
+ },
+ {
+ state => 'planned',
+ is_fixed => 0,
+ },
+ {
+ state => 'in progress',
+ is_fixed => 0,
+ },
+ {
+ state => 'fixed',
+ is_fixed => 1,
+ },
+ {
+ state => 'fixed - council',
+ is_fixed => 1,
+ },
+ {
+ state => 'fixed - user',
+ is_fixed => 1,
+ },
+ {
+ state => 'will not fix',
+ is_fixed => 0,
+ },
+) {
+ subtest $test->{state} . ' is fixed/open' => sub {
+ $problem->state( $test->{state} );
+ is $problem->is_fixed, $test->{is_fixed}, 'is_fixed';
+ };
+}
+
+for my $test (
+ {
+ state => 'partial',
+ is_visible => 0,
+ },
+ {
+ state => 'hidden',
+ is_visible => 0,
+ },
+ {
+ state => 'unconfirmed',
+ is_visible => 0,
+ },
+ {
+ state => 'confirmed',
+ is_visible => 1,
+ },
+ {
+ state => 'investigating',
+ is_visible => 1,
+ },
+ {
+ state => 'planned',
+ is_visible => 1,
+ },
+ {
+ state => 'in progress',
+ is_visible => 1,
+ },
+ {
+ state => 'fixed',
+ is_visible => 1,
+ },
+ {
+ state => 'fixed - council',
+ is_visible => 1,
+ },
+ {
+ state => 'fixed - user',
+ is_visible => 1,
+ },
+ {
+ state => 'will not fix',
+ is_visible => 1,
+ },
+) {
+ subtest $test->{state} . ' is fixed/open' => sub {
+ $problem->state( $test->{state} );
+ is $problem->is_visible, $test->{is_visible}, 'is_visible';
+ };
+}
+
done_testing();