115 lines
2.7 KiB
PHP
115 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace MailPoet\Test\Form\Block;
|
|
|
|
use MailPoet\Form\Block\Heading;
|
|
|
|
class HeadingTest extends \MailPoetUnitTest {
|
|
/** @var Heading */
|
|
private $heading;
|
|
|
|
public function _before() {
|
|
parent::_before();
|
|
$this->heading = new Heading();
|
|
}
|
|
|
|
public function testItShouldRenderHeading() {
|
|
$html = $this->heading->render([]);
|
|
expect($html)->startsWith('<h2');
|
|
}
|
|
|
|
public function testItShouldRenderContent() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h2>Header</h2>');
|
|
}
|
|
|
|
public function testItShouldRenderLevel() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'level' => 1,
|
|
],
|
|
]);
|
|
expect($html)->equals('<h1>Header</h1>');
|
|
}
|
|
|
|
public function testItShouldRenderClass() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'level' => 1,
|
|
'class_name' => 'class1 class2',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h1 class="class1 class2">Header</h1>');
|
|
}
|
|
|
|
public function testItShouldRenderAnchor() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'level' => 1,
|
|
'anchor' => 'anchor',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h1 id="anchor">Header</h1>');
|
|
}
|
|
|
|
public function testItShouldRenderAlign() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'level' => 1,
|
|
'align' => 'right',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h1 style="text-align: right">Header</h1>');
|
|
}
|
|
|
|
public function testItShouldRenderTextColour() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'level' => 1,
|
|
'text_color' => 'red',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h1 style="color: red">Header</h1>');
|
|
}
|
|
|
|
public function testItShouldRenderBackgroundColor() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'background_color' => 'red',
|
|
],
|
|
]);
|
|
expect($html)->contains('style="background-color: red');
|
|
expect($html)->contains('class="mailpoet-has-background-color"');
|
|
}
|
|
|
|
public function testItShouldRenderFontSize() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'font_size' => '33',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h2 style="font-size: 33px">Header</h2>');
|
|
}
|
|
|
|
public function testItShouldRenderLineHeight() {
|
|
$html = $this->heading->render([
|
|
'params' => [
|
|
'content' => 'Header',
|
|
'line_height' => '2.3',
|
|
],
|
|
]);
|
|
expect($html)->equals('<h2 style="line-height: 2.3">Header</h2>');
|
|
}
|
|
}
|