Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #118 from deanblackborough/v3.17.1
Browse files Browse the repository at this point in the history
v3.17.1
  • Loading branch information
deanblackborough authored Mar 7, 2019
2 parents 859bd43 + 0c5eea0 commit 86a4946
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 76 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

Full changelog for PHP Quill Renderer

## v3.17.1 - 2019-03-xx

* Fixed [#117](https://github.com/deanblackborough/php-quill-renderer/issues/117), compound
deltas not aware of the fact that they can also be links.
* Fixed [#109](https://github.com/deanblackborough/php-quill-renderer/issues/109) again as it
appears I did not fix it correctly before.

## v3.17.0 - 2019-03-04

* Handle custom color attribute in a better way, assign to style attribute if sensible,
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ for use under the MIT License (MIT).
* [raphaelsaunier](https://github.com/raphaelsaunier) [Issue #87] - Newlines proceeding inserts ignored, bug location.
* [Basil](https://github.com/nadar) [Issue #101] - Newline only inserts being ignored by parser.
* [Lee Hesselden](https://github.com/on2) [PR #104] - Color delta to allowing spans with a style:color="#xxx" definition. (Feature will be extended by [Issue #106])
* [Alex](https://github.com/AlexFence) [PR112] - Custom attributes assigned to style attribute if sensible.
* [davidraijmakers](https://github.com/davidraijmakers) [#Issue #108] - Children not supported with headers.
* [philippkuehn](https://github.com/philippkuehn) [#Issue #109] - Multiple list output incorrect and paragraphs not being closed.
* [Alex](https://github.com/AlexFence) [PR #112] - Custom attributes assigned to style attribute if sensible.
* [davidraijmakers](https://github.com/davidraijmakers) [Issue #108] - Children not supported with headers.
* [philippkuehn](https://github.com/philippkuehn) [Issue #109] - Multiple list output incorrect and paragraphs not being closed.
* [mechanicalgux](https://github.com/mechanicalgux) [Issue #117] - Compound deltas don't know that they can be links.

## Coding standard credit

* [Lode Claassen](https://github.com/lode) [PR#113] - Incorrect case in keyword.
* [Lode Claassen](https://github.com/lode) [PR #113] - Incorrect case in keyword.
109 changes: 104 additions & 5 deletions Tests/Api/BugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ final class BugTest extends \PHPUnit\Framework\TestCase
"attributes": {
"bold": true,
"link": "https://scrumpy.io"
},
"insert": "link"
},
"insert": "link"
},
{
"attributes": {
Expand All @@ -179,6 +179,77 @@ final class BugTest extends \PHPUnit\Framework\TestCase
}
]
}';
private $delta_bug_117_links_deltas_with_attributes = '
{
"ops":[
{
"insert":"The "
},
{
"attributes":{
"italic":true,
"link":"https://www.google.com"
},
"insert":"quick"
},
{
"insert":" brown fox "
},
{
"attributes":{
"bold":true,
"link":"https://www.google.com"
},
"insert":"jumps"
},
{
"insert":" over t"
},
{
"attributes":{
"link":"https://www.google.com"
},
"insert":"he "
},
{
"attributes":{
"italic":true,
"bold":true,
"link":"https://www.google.com"
},
"insert":"lazy"
},
{
"attributes":{
"link":"https://www.google.com"
},
"insert":" do"
},
{
"insert":"g... "
},
{
"attributes":{
"italic":true,
"link":"https://www.amazon.com"
},
"insert":"Space"
},
{
"insert":" "
},
{
"attributes":{
"bold":true,
"link":"https://www.yahoo.com"
},
"insert":"removed"
},
{
"insert":".\n"
}
]
}';

private $expected_bug_external_3 = '<p>Lorem ipsum
<br />
Expand All @@ -190,7 +261,7 @@ final class BugTest extends \PHPUnit\Framework\TestCase
</p>';
private $expected_bug_108_link_within_header = '<h2>This is a <a href="https://link.com">header</a>, it has a link within it.</h2>';
private $expected_bug_108_link_end_of_header = '<h2>This is a header, with a link at the <a href="https://link.com">end</a></h2>';
private $expected_bug_109_list_outout_incorrect = '<h1>Headline 1</h1>
private $expected_bug_109_list_output_incorrect = '<h1>Headline 1</h1>
<p>Some text. <strong>Bold Text</strong>. <em>Italic Text</em>. <em><strong>Bold and italic Text</strong></em>. Here is a <a href="https://scrumpy.io">Link</a>.
<br />
</p>
Expand All @@ -202,11 +273,14 @@ final class BugTest extends \PHPUnit\Framework\TestCase
</ol>
<ul>
<li>unordered list item</li>
<li>unordered list item with <a href="https://scrumpy.io">link</a><strong>link</strong></li>
<li>unordered list item with <a href="https://scrumpy.io"><strong>link</strong></a></li>
<li>unordered list item</li>
</ul>
<p>Some Text.
<br />
</p>';
private $expected_bug_117_links_deltas_with_attributes = '<p>The <a href="https://www.google.com"><em>quick</em></a> brown fox <a href="https://www.google.com"><strong>jumps</strong></a> over t<a href="https://www.google.com">he </a><a href="https://www.google.com"><em><strong>lazy</strong></em></a><a href="https://www.google.com"> do</a>g... <a href="https://www.amazon.com"><em>Space</em></a><a href="https://www.yahoo.com"><strong>removed</strong></a>.
<br />
</p>';

/**
Expand Down Expand Up @@ -303,9 +377,34 @@ public function testIncorrectListOutput()
}

$this->assertEquals(
$this->expected_bug_109_list_outout_incorrect,
$this->expected_bug_109_list_output_incorrect,
trim($result),
__METHOD__ . ' list output incorrect'
);
}

/**
* Links with attributes not being created correctly
* Bug report https://github.com/deanblackborough/php-quill-renderer/issues/117
*
* @return void
* @throws \Exception
*/
public function testLinkDeltasWithAdditionalAttributes()
{
$result = null;

try {
$quill = new QuillRender($this->delta_bug_117_links_deltas_with_attributes);
$result = $quill->render();
} catch (\Exception $e) {
$this->fail(__METHOD__ . 'failure, ' . $e->getMessage());
}

$this->assertEquals(
$this->expected_bug_117_links_deltas_with_attributes,
trim($result),
__METHOD__ . ' link output incorrect'
);
}
}
Loading

0 comments on commit 86a4946

Please sign in to comment.