diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-01-17 09:43:02 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-01-17 09:43:02 +0000 |
commit | e0c2c73991904b7586f9404f36e3193caeab4887 (patch) | |
tree | 936cbd0a264701b9dcc3569891e82dc4ed83a349 /t | |
parent | df174234d36460215e880aca68e0a4c6633f04e1 (diff) | |
parent | 609ed81c84129744cfbc9bc8616e0e04a861fd9a (diff) |
Merge branch 'dashboard-optgroup'
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/dashboard.t | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 15c718c74..72fc00128 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -30,7 +30,11 @@ my $other_body = $mech->create_body_ok(1234, 'Some Other Council'); my $body = $mech->create_body_ok(2651, 'City of Edinburgh Council'); my @cats = ('Litter', 'Other', 'Potholes', 'Traffic lights'); for my $contact ( @cats ) { - $mech->create_contact_ok(body_id => $body->id, category => $contact, email => "$contact\@example.org"); + my $c = $mech->create_contact_ok(body_id => $body->id, category => $contact, email => "$contact\@example.org"); + if ($contact eq 'Potholes') { + $c->set_extra_metadata(group => ['Road']); + $c->update; + } } my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1); @@ -70,7 +74,7 @@ foreach my $problem (@closed_problems) { } my $categories = scraper { - process "select[name=category] > option", 'cats[]' => 'TEXT', + process "select[name=category] option", 'cats[]' => 'TEXT', process "table[id=overview] > tr", 'rows[]' => scraper { process 'td', 'cols[]' => 'TEXT' }, @@ -135,8 +139,9 @@ FixMyStreet::override_config { subtest 'The correct categories and totals shown by default' => sub { $mech->get_ok("/dashboard"); - my $expected_cats = [ 'All', @cats ]; + my $expected_cats = [ 'All', 'Litter', 'Other', 'Traffic lights', 'Potholes' ]; my $res = $categories->scrape( $mech->content ); + $mech->content_contains('<optgroup label="Road">'); is_deeply( $res->{cats}, $expected_cats, 'correct list of categories' ); # Three missing as more than a month ago test_table($mech->content, 1, 0, 0, 1, 0, 0, 0, 0, 2, 0, 4, 6, 7, 3, 0, 10, 10, 3, 4, 17); |