diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/reports.t | 2 | ||||
-rw-r--r-- | t/cobrand/isleofwight.t | 2 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 17 | ||||
-rw-r--r-- | t/template.t | 33 |
4 files changed, 44 insertions, 10 deletions
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index ac230ef95..670c5cfc3 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -139,7 +139,7 @@ FixMyStreet::override_config { is $mech->uri->path, '/reports/Birmingham/Bordesley+and+Highgate'; $mech->get_ok('/reports/Birmingham/Bordesley+and+Highgate|Birchfield'); is $mech->uri->path, '/reports/Birmingham/Bordesley+and+Highgate%7CBirchfield'; - $mech->content_contains('Birchfield, Bordesley & Highgate'); + $mech->content_contains('Birchfield, Bordesley & Highgate'); }; $mech->get_ok('/reports/Westminster'); diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index 9e1b80c68..c28c30503 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -425,7 +425,7 @@ subtest "check not responsible as correct text" => sub { $mech->get_ok('/report/' . $p->id); }; - $mech->content_contains("not Island Roads' responsibility", "not reponsible message contains correct text"); + $mech->content_contains("not Island Roads' responsibility", "not reponsible message contains correct text"); $p->comments->delete; $p->delete; }; diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 6825caccf..b82d50b68 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -1,6 +1,7 @@ # TODO # Overdue alerts +use utf8; use DateTime; use Email::MIME; use File::Temp; @@ -109,11 +110,11 @@ my @reports = $mech->create_problems_for_body( 1, $division->id, 'Test', { my $report = $reports[0]; $mech->get_ok( '/report/' . $report->id ); -$mech->content_contains('Überprüfung ausstehend') +$mech->content_contains('Überprüfung ausstehend') or die $mech->content; my $json = $mech->get_ok_json( '/report/ajax/' . $report->id ); -is $json->{report}->{title}, "Überprüfung ausstehend", "correct title"; +is $json->{report}->{title}, "Überprüfung ausstehend", "correct title"; is $json->{report}->{state}, "submitted", "correct state"; subtest "Banners are displayed correctly" => sub { @@ -308,7 +309,7 @@ subtest "report_edit" => sub { $mech->log_in_ok( 'dm1@example.org') ; $mech->get_ok( '/admin/report_edit/' . $report->id ); - $mech->content_contains( 'Unbestätigt' ); # Unconfirmed email + $mech->content_contains( 'Unbestätigt' ); # Unconfirmed email $mech->submit_form_ok( { with_fields => { state => 'confirmed' } } ); $mech->get_ok( '/report/' . $report->id ); @@ -538,7 +539,7 @@ subtest 'Test publishing of final update by DM' => sub { $mech->content_contains('Admin district'); - $mech->content_lacks( 'Unbestätigt' ); # Confirmed email + $mech->content_lacks( 'Unbestätigt' ); # Confirmed email $mech->submit_form_ok( { with_fields => { status_update => 'FINAL UPDATE' } } ); $mech->form_with_fields( 'status_update' ); $mech->submit_form_ok( { button => 'publish_response' } ); @@ -573,7 +574,7 @@ subtest "Assign feedback pending (via confirmed), don't confirm email, no email $mech->content_contains('Second Test'); $mech->get_ok( '/admin/report_edit/' . $report->id ); - $mech->content_contains( 'Unbestätigt' ); + $mech->content_contains( 'Unbestätigt' ); $report->discard_changes; $mech->form_with_fields( 'status_update' ); $mech->submit_form_ok( { button => 'publish_response', with_fields => { status_update => 'FINAL UPDATE' } } ); @@ -757,7 +758,7 @@ subtest "phone number is mandatory" => sub { $user = $mech->log_in_ok( 'dm1@example.org' ); $mech->get_ok( '/report/new?lat=47.381817&lon=8.529156' ); $mech->submit_form( with_fields => { phone => "" } ); - $mech->content_contains( 'Diese Information wird benötigt' ); + $mech->content_contains( 'Diese Information wird benötigt' ); $mech->log_out_ok; }; @@ -774,7 +775,7 @@ subtest "phone number is not mandatory for reports from mobile apps" => sub { }); my $res = $mech->response; ok $res->header('Content-Type') =~ m{^application/json\b}, 'response should be json'; - unlike $res->content, qr/Diese Information wird benötigt/, 'response should not contain phone error'; + unlike $res->content, qr/Diese Information wird benötigt/, 'response should not contain phone error'; # Clear out the mailq $mech->clear_emails_ok; }; @@ -861,7 +862,7 @@ subtest "test stats" => sub { is $mech->res->code, 200, "superuser should be able to see stats page"; $mech->content_contains('Innerhalb eines Arbeitstages moderiert: 3'); - $mech->content_contains('Innerhalb von fünf Arbeitstagen abgeschlossen: 3'); + $mech->content_contains('Innerhalb von fünf Arbeitstagen abgeschlossen: 3'); # my @data = $mech->content =~ /(?:moderiert|abgeschlossen): \d+/g; # diag Dumper(\@data); use Data::Dumper; diff --git a/t/template.t b/t/template.t new file mode 100644 index 000000000..1763a7f12 --- /dev/null +++ b/t/template.t @@ -0,0 +1,33 @@ +use FixMyStreet::Test; + +use_ok 'FixMyStreet::Template'; + +my $tt = FixMyStreet::Template->new; + +my $output = ''; +$tt->process(\'[% s %] [% s | safe %] [% s | upper %] [% s | html %]', { + s => 'sp<i>l</i>it' +}, \$output); +is $output, 'sp<i>l</i>it sp<i>l</i>it SP<I>L</I>IT sp<i>l</i>it'; + +$output = ''; +$tt->process(\'[% s | html_para %]', { s => 'sp<i>l</i>it' }, \$output); +is $output, "<p>\nsp<i>l</i>it</p>\n"; + +$output = ''; +$tt->process(\'[% loc("s") %] [% loc("s") | html_para %]', {}, \$output); +is $output, "s <p>\ns</p>\n"; + +$output = ''; +$tt->process(\'[% s.upper %] [% t = s %][% t %] [% t.upper %]', { + s => 'sp<i>l</i>it' +}, \$output); +is $output, 'SP<I>L</I>IT sp<i>l</i>it SP<I>L</I>IT'; + +$output = ''; +$tt->process(\'H: [% s.split(":").join(",") %]', { + s => '1:sp<i>l</i>it:3' +}, \$output); +is $output, 'H: 1,sp<i>l</i>it,3'; + +done_testing; |