diff --git a/tests/unit/Grav/Common/MarkdownTest.php b/tests/unit/Grav/Common/MarkdownTest.php index 6968bfc0d..6a5c8cab3 100644 --- a/tests/unit/Grav/Common/MarkdownTest.php +++ b/tests/unit/Grav/Common/MarkdownTest.php @@ -61,8 +61,23 @@ class MarkdownTest extends \Codeception\TestCase\Test return preg_replace('/^\s*(.*)/', '', $string); } + public function testAnchorLinks() + { + $this->assertSame($this->parsedown->text('[Peer Anchor](../item2-1#foo)'), + '
'); + $this->assertSame($this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'), + ''); +// $this->assertSame($this->parsedown->text('[Current Anchor](#foo)'), +// ''); + $this->assertSame($this->parsedown->text('[Root Anchor](/#foo)'), + ''); + + } + public function testSlugRelativeLinks() { + $this->assertSame($this->parsedown->text('[Peer Page](../item2-1)'), + ''); $this->assertSame($this->parsedown->text('[Down a Level](item2-2-1)'), ''); $this->assertSame($this->parsedown->text('[Up a Level](..)'), @@ -83,6 +98,8 @@ class MarkdownTest extends \Codeception\TestCase\Test public function testDirectoryRelativeLinks() { + $this->assertSame($this->parsedown->text('[Peer Page](../01.item2-1)'), + ''); $this->assertSame($this->parsedown->text('[Down a Level](01.item2-2-1)'), ''); $this->assertSame($this->parsedown->text('[Up and Down](../../03.item3/03.item3-3)'), @@ -97,6 +114,22 @@ class MarkdownTest extends \Codeception\TestCase\Test ''); } + public function testDirectoryAbsoluteLinks() + { + $this->assertSame($this->parsedown->text('[Peer Page](/item2/item2-1)'), + ''); + $this->assertSame($this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)'), + ''); + $this->assertSame($this->parsedown->text('[Up a Level](/item2)'), + ''); + $this->assertSame($this->parsedown->text('[With Query](/item2?foo=bar)'), + ''); + $this->assertSame($this->parsedown->text('[With Param](/item2/foo:bar)'), + ''); + $this->assertSame($this->parsedown->text('[With Anchor](/item2#foo)'), + ''); + } + public function testSpecialProtocols() { $this->assertSame($this->parsedown->text('[mailto](mailto:user@domain.com)'),