Add background color indicating class also for custom backgrounds

[MAILPOET-2609]
This commit is contained in:
Rostislav Wolny
2020-02-19 12:50:15 +01:00
committed by Pavel Dohnal
parent ab1e2ef0a9
commit 6b718dfb2c
2 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,8 @@ class Columns {
if (!empty($params['background_color'])) {
$classes[] = "has-{$params['background_color']}-background-color";
$classes[] = "mailpoet_column_has_background";
} elseif (!empty($params['custom_background_color'])) {
$classes[] = "mailpoet_column_has_background";
}
if (!empty($params['text_color'])) {
$classes[] = "has-{$params['text_color']}-color";

View File

@ -71,9 +71,11 @@ class ColumnsTest extends \MailPoetUnitTest {
$block = $this->block;
$block['params']['custom_background_color'] = '#ffffff';
$html = $this->columns->render($block, 'content');
$columns = $this->htmlParser->getElementByXpath($html, '//div[@class="mailpoet_form_columns"]');
$columns = $this->htmlParser->getElementByXpath($html, '//div[1]');
$style = $this->htmlParser->getAttribute($columns, 'style');
expect($style->textContent)->contains('background-color:#ffffff;');
$class = $this->htmlParser->getAttribute($columns, 'class');
expect($class->textContent)->contains('mailpoet_column_has_background');
}
public function testItShouldCustomTextColor() {