diff --git a/_test/cases/inc/parser/xhtml_links.test.php b/_test/cases/inc/parser/xhtml_links.test.php index 0ad96c793fe41f5a809a497f176d3fc29b633d2b..4954086a2e6a2192fe29b7f0828642920aa2a1b3 100644 --- a/_test/cases/inc/parser/xhtml_links.test.php +++ b/_test/cases/inc/parser/xhtml_links.test.php @@ -41,4 +41,93 @@ class xhtml_links_test extends UnitTestCase { $this->assertEqual($p->doc,$expect); } + /** + * Produced by syntax like [[ ]] + */ + function test_empty_internallink(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink(''); + + $expect = '<span class="curid"><a href="/./doku.php/my:space" class="wikilink1" title="my:space">start</a></span>'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[ |my caption]] + */ + function test_empty_internallink_with_caption(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink('', 'my caption'); + + $expect = '<span class="curid"><a href="/./doku.php/my:space" class="wikilink1" title="my:space">my caption</a></span>'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[?do=index]] + */ + function test_empty_internallink_index(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink('?do=index'); + + $expect = '<span class="curid"><a href="/./doku.php/my:space?do=index" class="wikilink1" title="my:space">start</a></span>'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[?do=index|my caption]] + */ + function test_empty_internallink_index_with_caption(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink('?do=index', 'my caption'); + + $expect = '<span class="curid"><a href="/./doku.php/my:space?do=index" class="wikilink1" title="my:space">my caption</a></span>'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[#test]] + */ + function test_empty_locallink(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->locallink('test'); + + $expect = '<a href="#test" title="my:space ↵" class="wikilink1">test</a>'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[#test|my caption]] + */ + function test_empty_locallink_with_caption(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->locallink('test', 'my caption'); + + $expect = '<a href="#test" title="my:space ↵" class="wikilink1">my caption</a>'; + + $this->assertEqual($p->doc, $expect); + } }