Add test for footer
[MAILPOET-2086]
This commit is contained in:
committed by
M. Shull
parent
28c87b746c
commit
5055c53e2b
@@ -34,8 +34,7 @@ class Footer {
|
||||
$style = EHelper::escapeHtmlStyleAttr($style);
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_header_footer_padded mailpoet_footer" ' . $background_color . '
|
||||
style="' . $style . '">
|
||||
<td class="mailpoet_header_footer_padded mailpoet_footer" ' . $background_color . ' style="' . $style . '">
|
||||
' . str_replace('&', '&', $DOM->html()) . '
|
||||
</td>
|
||||
</tr>';
|
||||
|
54
tests/unit/Newsletter/Renderer/Blocks/FooterTest.php
Normal file
54
tests/unit/Newsletter/Renderer/Blocks/FooterTest.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace MailPoet\Newsletter\Renderer\Blocks;
|
||||
|
||||
class FooterTest extends \MailPoetUnitTest {
|
||||
|
||||
private $block = [
|
||||
'type' => 'footer',
|
||||
'text' => '<p>Footer text. <a href="http://example.com">link</a></p>',
|
||||
'styles' => [
|
||||
'block' => [
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
'text' => [
|
||||
'fontColor' => '#222222',
|
||||
'fontFamily' => 'Roboto',
|
||||
'fontSize' => '12px',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
'link' => [
|
||||
'fontColor' => '#689f2c',
|
||||
'textDecoration' => 'none',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
function testItRendersCorrectly() {
|
||||
$output = Footer::render($this->block);
|
||||
$expected_result = '
|
||||
<tr>
|
||||
<td class="mailpoet_header_footer_padded mailpoet_footer" style="line-height: 19.2px;color: #222222;font-family: roboto, \'helvetica neue\', helvetica, arial, sans-serif;font-size: 12px;text-align: center;">
|
||||
Footer text. <a href="http://example.com" style="color:#689f2c;text-decoration:none">link</a>
|
||||
</td>
|
||||
</tr>';
|
||||
expect($output)->equals($expected_result);
|
||||
}
|
||||
|
||||
function testItRendersWithBackgroundColor() {
|
||||
$this->block['styles']['block']['backgroundColor'] = '#f0f0f0';
|
||||
$output = Footer::render($this->block);
|
||||
$expected_result = '
|
||||
<tr>
|
||||
<td class="mailpoet_header_footer_padded mailpoet_footer" bgcolor="#f0f0f0" style="line-height: 19.2px;background-color: #f0f0f0;color: #222222;font-family: roboto, \'helvetica neue\', helvetica, arial, sans-serif;font-size: 12px;text-align: center;">
|
||||
Footer text. <a href="http://example.com" style="color:#689f2c;text-decoration:none">link</a>
|
||||
</td>
|
||||
</tr>';
|
||||
expect($output)->equals($expected_result);
|
||||
}
|
||||
|
||||
function testItPrefersInlinedCssForLinks() {
|
||||
$this->block['text'] = '<p>Footer text. <a href="http://example.com" style="color:#aaaaaa;">link</a></p>';
|
||||
$output = Footer::render($this->block);
|
||||
expect($output)->contains('<a href="http://example.com" style="color:#aaaaaa;text-decoration:none">link</a>');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user