diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-07-15 18:31:52 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-08-01 11:52:22 +0100 |
commit | 1820db45188fd62699223f63167c5f7250d1b7a6 (patch) | |
tree | 116814d9bb6ebd7f6fa015d3e492993b620ac6b1 /t/app/controller/auth.t | |
parent | 0271c3fa016178f8c72b1192f1d0ed57437ec4c4 (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/app/controller/auth.t')
-rw-r--r-- | t/app/controller/auth.t | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t index 60f22acfb..251aa2977 100644 --- a/t/app/controller/auth.t +++ b/t/app/controller/auth.t @@ -72,8 +72,7 @@ $mech->not_logged_in_ok; is $email->header('To'), $test_email, "to is correct"; # extract the link - my ($link) = $email->body =~ m{(http://\S+)}; - ok $link, "Found a link in email '$link'"; + my $link = $mech->get_link_from_email($email); # check that the user does not exist sub get_user { @@ -117,9 +116,7 @@ $mech->not_logged_in_ok; # follow link and change password - check not prompted for old password $mech->not_logged_in_ok; - my $email = $mech->get_email; - $mech->clear_emails_ok; - my ($link) = $email->body =~ m{(http://\S+)}; + my $link = $mech->get_link_from_email; $mech->get_ok($link); is $mech->uri->path, '/faq', "redirected to the Help page"; @@ -187,9 +184,7 @@ subtest "Test change email page" => sub { $mech->submit_form_ok({ with_fields => { email => $test_email2 } }, "change_email to $test_email2"); is $mech->uri->path, '/auth/change_email', "still on change email page"; $mech->content_contains( 'Now check your email', "found check your email" ); - my $email = $mech->get_email; - $mech->clear_emails_ok; - my ($link) = $email->body =~ m{(http://\S+)}; + my $link = $mech->get_link_from_email; $mech->get_ok($link); is $mech->uri->path, '/auth/change_email/success', "redirected to the change_email page"; $mech->content_contains('successfully confirmed'); @@ -201,9 +196,7 @@ subtest "Test change email page" => sub { ); is $mech->uri->path, '/auth/change_email', "still on change email page"; $mech->content_contains( 'Now check your email', "found check your email" ); - $email = $mech->get_email; - $mech->clear_emails_ok; - ($link) = $email->body =~ m{(http://\S+)}; + $link = $mech->get_link_from_email; $mech->get_ok($link); is $mech->uri->path, '/auth/change_email/success', "redirected to the change_email page"; $mech->content_contains('successfully confirmed'); @@ -214,9 +207,7 @@ subtest "Test change email page" => sub { ); is $mech->uri->path, '/auth/change_email', "still on change email page"; $mech->content_contains( 'Now check your email', "found check your email" ); - $email = $mech->get_email; - $mech->clear_emails_ok; - ($link) = $email->body =~ m{(http://\S+)}; + $link = $mech->get_link_from_email; $mech->log_out_ok; $mech->get_ok($link); isnt $mech->uri->path, '/auth/change_email/success', "not redirected to the change_email page"; |