This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from deanblackborough/v3.10.1
V3.10.1
- Loading branch information
Showing
5 changed files
with
129 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
|
||
namespace DBlackborough\Quill\Tests\Composite\Html; | ||
|
||
require __DIR__ . '../../../../vendor/autoload.php'; | ||
|
||
use DBlackborough\Quill\Render as QuillRender; | ||
|
||
/** | ||
* Testing mixing different types of data | ||
*/ | ||
final class MixTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
private $delta_paragraph_after_two_headers = '{ | ||
"ops":[ | ||
{ | ||
"insert":"Primary Header" | ||
}, | ||
{ | ||
"attributes":{ | ||
"header":1 | ||
}, | ||
"insert":"\n" | ||
}, | ||
{ | ||
"insert":"\nSecondary header" | ||
}, | ||
{ | ||
"attributes":{ | ||
"header":2 | ||
}, | ||
"insert":"\n" | ||
}, | ||
{ | ||
"insert":"\nA paragraph.\n" | ||
} | ||
] | ||
}'; | ||
private $delta_list_and_header = '{ | ||
"ops":[ | ||
{ | ||
"insert":"Another list" | ||
}, | ||
{ | ||
"attributes":{ | ||
"list":"bullet" | ||
}, | ||
"insert":"\n" | ||
}, | ||
{ | ||
"insert":"List item two entry two" | ||
}, | ||
{ | ||
"attributes":{ | ||
"list":"bullet" | ||
}, | ||
"insert":"\n" | ||
}, | ||
{ | ||
"insert":"\nAnd now a HEADER" | ||
}, | ||
{ | ||
"attributes":{ | ||
"header":4 | ||
}, | ||
"insert":"\n" | ||
} | ||
] | ||
}'; | ||
|
||
private $expected_paragraph_after_two_headers = '<h1>Primary Header</h1><h2>Secondary header</h2><p>A paragraph.</p>'; | ||
private $expected_list_and_header = '<ul><li>Another list</li><li>List item two entry two</li></ul><h4>And now a HEADER</h4>'; | ||
|
||
/** | ||
* Test for issue #64, opening p tag between two opening headers | ||
* | ||
* @return void | ||
* @throws \Exception | ||
*/ | ||
public function testParagraphAfterMultipleHeaders() | ||
{ | ||
$result = null; | ||
|
||
try { | ||
$quill = new QuillRender($this->delta_paragraph_after_two_headers); | ||
$result = $quill->render(); | ||
} catch (\Exception $e) { | ||
$this->fail(__METHOD__ . 'failure, ' . $e->getMessage()); | ||
} | ||
|
||
$this->assertEquals( | ||
$this->expected_paragraph_after_two_headers, | ||
$result, | ||
__METHOD__ . ' - paragraph after two headers failure'); | ||
} | ||
|
||
/** | ||
* Test for issue #64, header after list at end of content | ||
* | ||
* @return void | ||
* @throws \Exception | ||
*/ | ||
public function testListAfterHeader() | ||
{ | ||
$result = null; | ||
|
||
try { | ||
$quill = new QuillRender($this->delta_list_and_header); | ||
$result = $quill->render(); | ||
} catch (\Exception $e) { | ||
$this->fail(__METHOD__ . 'failure, ' . $e->getMessage()); | ||
} | ||
|
||
$this->assertEquals($this->expected_list_and_header, | ||
$result, | ||
__METHOD__ . ' - header after list at end of content failure'); | ||
} | ||
} |