aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-07-15 18:31:52 +0100
committerDave Arter <davea@mysociety.org>2016-08-01 11:52:22 +0100
commit1820db45188fd62699223f63167c5f7250d1b7a6 (patch)
tree116814d9bb6ebd7f6fa015d3e492993b620ac6b1 /t/cobrand
parent0271c3fa016178f8c72b1192f1d0ed57437ec4c4 (diff)
Add HTML email templates.
Design is all Zarino. This adds the ability to send HTML emails, including attached inline images. When included, this is done as a multipart/related email containing a multipart/alternative (of plain and HTML) and any attached images, so that the images are available even if HTML mail is not. The alert emails list data has been improved so it can be constructed in the templates rather than the code. Various templates have been tidied. Various workarounds for email clients have been made, including: * <th> is used so that the Android 4.x mail client can give them `block` styling in the small screen media query. * Font settings defined on every table cell (<th>) so that sans-serif fonts are used in Outlook, rather than Times New Roman. * A three-column wrapper table to create a 620px centred content area that also shrinks down on narrow screens. (Outlook doesn’t like max-width, so this is the simplest alternative.) * Enforcing a sensible (500px) min-width for the main content area, on clients that don’t support media queries (eg: native Gmail app). * Giant borders on buttons so Outlook displays them * Image alignment with align rather than float.
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/bromley.t7
-rw-r--r--t/cobrand/fixamingata.t11
2 files changed, 9 insertions, 9 deletions
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index 6066c66b6..e39bcbe4c 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -103,10 +103,9 @@ for my $test (
};
$mech->content_contains('Nearly done! Now check your email');
- my $email = $mech->get_email;
- ok $email, "got an email";
- like $email->body, qr/This update will be sent to Bromley Council/i, "Email indicates problem will be sent to Bromley";
- unlike $email->body, qr/Note that we do not send updates to/i, "Email does not say updates aren't sent to Bromley";
+ my $body = $mech->get_text_body_from_email;
+ like $body, qr/This update will be sent to Bromley Council/i, "Email indicates problem will be sent to Bromley";
+ unlike $body, qr/Note that we do not send updates to/i, "Email does not say updates aren't sent to Bromley";
my $unreg_user = FixMyStreet::App->model( 'DB::User' )->find( { email => 'unregistered@example.com' } );
diff --git a/t/cobrand/fixamingata.t b/t/cobrand/fixamingata.t
index 0cf7a31fe..2ef3c09b4 100644
--- a/t/cobrand/fixamingata.t
+++ b/t/cobrand/fixamingata.t
@@ -46,10 +46,11 @@ FixMyStreet::override_config {
FixMyStreet::DB->resultset('Problem')->send_reports();
};
my $email = $mech->get_email;
-like $email->header('Content-Type'), qr/utf-8/, 'encoding looks okay';
+my $plain = $mech->get_text_body_from_email($email, 1);
+like $plain->header('Content-Type'), qr/utf-8/, 'encoding looks okay';
like $email->header('Subject'), qr/Ny rapport: Test Test/, 'subject looks okay';
like $email->header('To'), qr/other\@example.org/, 'to line looks correct';
-like $email->body_str, qr/V\xe4nligen,/, 'signature looks correct';
+like $plain->body_str, qr/V\xe4nligen,/, 'signature looks correct';
$mech->clear_emails_ok;
my $user =
@@ -89,10 +90,10 @@ FixMyStreet::override_config {
FixMyStreet::DB->resultset('AlertType')->email_alerts();
};
-$mech->email_count_is(1);
$email = $mech->get_email;
-like $email->header('Content-Type'), qr/utf-8/, 'encoding looks okay';
-like $email->body_str, qr/V\xe4nligen,/, 'signature looks correct';
+$plain = $mech->get_text_body_from_email($email, 1);
+like $plain->header('Content-Type'), qr/utf-8/, 'encoding looks okay';
+like $plain->body_str, qr/V\xe4nligen,/, 'signature looks correct';
$mech->clear_emails_ok;
subtest "Test ajax decimal points" => sub {