'text',
'text' => 'Text',
];
/** @var pQuery */
private $parser;
public function _before() {
parent::_before();
$this->parser = new pQuery;
}
public function testItRendersPlainText() {
$output = (new Text)->render($this->block);
$expectedResult = '
Text
|
';
expect($output)->equals($expectedResult);
}
public function testItRendersParagraph() {
$this->block['text'] = 'Text
';
$output = (new Text)->render($this->block);
$table = $this->parser->parseStr($output)->query('table');
assert($table instanceof pQuery);
$paragraphTable = $table[0]->toString();
$expectedResult = '';
expect($paragraphTable)->equals($expectedResult);
}
public function testItRendersNewLinesBetweenWordPressParagraphs(): void {
$this->block['text'] = '
First
Second
';
$output = (new Text)->render($this->block);
$table = $this->parser->parseStr($output)->query('table');
assert($table instanceof pQuery);
$paragraphTable = $table[0]->toString();
$expectedResult = '';
expect($paragraphTable)->equals($expectedResult);
$paragraphTable = $table[1]->toString();
$expectedResult = '';
expect($paragraphTable)->equals($expectedResult);
}
public function testItRendersNewLinesWordPressParagraphAndHeading(): void {
$this->block['text'] = '
First
Second
';
$output = (new Text)->render($this->block);
$table = $this->parser->parseStr($output)->query('table');
assert($table instanceof pQuery);
$paragraphTable = $table[0]->toString();
$expectedResult = '';
expect($paragraphTable)->equals($expectedResult);
$heading = $this->parser->parseStr($output)->query('h1');
assert($heading instanceof pQuery);
$heading = $heading[0]->toString();
$expectedResult = 'Second
';
expect($heading)->equals($expectedResult);
}
public function testItRendersList() {
$this->block['text'] = '';
$output = (new Text)->render($this->block);
$ul = $this->parser->parseStr($output)->query('ul');
assert($ul instanceof pQuery);
$list = $ul[0]->toString();
$expectedResult = '';
expect($list)->equals($expectedResult);
}
public function testItRendersBlockquotes() {
$this->block['text'] = 'Quote
';
$output = (new Text)->render($this->block);
$table = $this->parser->parseStr($output)->query('table');
assert($table instanceof pQuery);
$blockquoteTable = $table[0]->toString();
$expectedResult = '';
expect($blockquoteTable)->equals($expectedResult);
}
public function testItShouldRemoveEmptyParagraphs() {
$this->block['text'] = 'Text
Text2
';
$output = (new Text)->render($this->block);
$expectedResult = '
|
';
expect($output)->equals($expectedResult);
}
public function testItStylesHeadings() {
$this->block['text'] = 'Heading
Heading 2
';
$output = (new Text)->render($this->block);
expect($output)->stringContainsString('Heading
');
expect($output)->stringContainsString('Heading 2
');
}
public function testItStylesHeadingsCenter() {
$this->block['text'] = 'Let\'s Get Started!
';
$output = (new Text)->render($this->block);
expect($output)->stringContainsString('