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

Commit

Permalink
Adding failing test for #108
Browse files Browse the repository at this point in the history
* Failing test for #108
  • Loading branch information
deanblackborough committed Dec 12, 2018
1 parent edf8221 commit ffa00bc
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion Tests/Api/BugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ final class BugTest extends \PHPUnit\Framework\TestCase
]
}';

private $delta_bug_108 = '{
"ops":[
{"insert":"Wilt u één van bovenstaande punten wijzigen, dan "},
{"attributes":{"link":"https://studiekeuze123.test/contact"},"insert":"contactformulier"},
{"insert":".  asd\n\nWijzigingen die "},
{"attributes":{"color":"#24372e"},"insert":"uiterlijk 20 november 2018 "},
{"insert":"bij ons zijn binnengekomen, worden nog verwerkt in release 18.10 op 12 december 2018. Wijzigingen in CROHO (zoals nieuwe opleidingen) dienen ook uiterlijk 20 november door u te zijn ingevoerd om meegenomen te worden in de release van december 2018."}
]
}';

private $delta_bug_external_3 = '{"ops":[{"insert":"Lorem ipsum\nLorem ipsum\n\nLorem ipsum\n"}]}';

private $expected_bug_101 = "<h1>Hallo</h1>
Expand All @@ -55,6 +65,8 @@ final class BugTest extends \PHPUnit\Framework\TestCase
<p>https://heartbeat.gmbh</p>
<p></p>";

private $expected_bug_108 = '';

private $expected_bug_external_3 = "<p>Lorem ipsum<br />
Lorem ipsum</p>
<p>Lorem ipsum</p>";
Expand Down Expand Up @@ -87,7 +99,7 @@ public function testNewlineOnlyInsertsIgnored()

/**
* Newlines still proving to be an issue
* Bug report https://github.com/nadar/quill-delta-parser/issues/3 *
* Bug report https://github.com/nadar/quill-delta-parser/issues/3
*
* @return void
* @throws \Exception
Expand All @@ -109,4 +121,29 @@ public function testNewlinesNotGeneratingNewParagraph()
__METHOD__ . ' newline issues, no new paragraph'
);
}

/**
* Issue with links going to a new line
* Bug report https://github.com/deanblackborough/php-quill-renderer/issues/108
*
* @return void
* @throws \Exception
*/
public function testLinksOnANewLine()
{
$result = null;

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

$this->assertEquals(
$this->expected_bug_108,
trim($result),
__METHOD__ . ' links appear on their own line'
);
}
}

0 comments on commit ffa00bc

Please sign in to comment.