Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template authors now can use tpl_sidebar() to include the sidebar. Sidebars can be defined in subnamespaces as well
- Loading branch information
1 parent
65ee48a
commit e66d3e6
Showing
6 changed files
with
119 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
class pageutils_findnearest_test extends DokuWikiTest { | ||
function testNoSidebar() { | ||
global $ID; | ||
|
||
$ID = 'foo:bar:baz:test'; | ||
$sidebar = page_findnearest('sidebar'); | ||
$this->assertEquals(false, $sidebar); | ||
} | ||
|
||
function testExistingSidebars() { | ||
global $ID; | ||
|
||
saveWikiText('sidebar', 'topsidebar-test', ''); | ||
|
||
$ID = 'foo:bar:baz:test'; | ||
$sidebar = page_findnearest('sidebar'); | ||
$this->assertEquals('sidebar', $sidebar); | ||
|
||
$ID = 'foo'; | ||
$sidebar = page_findnearest('sidebar'); | ||
$this->assertEquals('sidebar', $sidebar); | ||
|
||
saveWikiText('foo:bar:sidebar', 'bottomsidebar-test', ''); | ||
|
||
$ID = 'foo:bar:baz:test'; | ||
$sidebar = page_findnearest('sidebar'); | ||
$this->assertEquals('foo:bar:sidebar', $sidebar); | ||
|
||
$ID = 'foo:bar:test'; | ||
$sidebar = page_findnearest('sidebar'); | ||
$this->assertEquals('foo:bar:sidebar', $sidebar); | ||
|
||
$ID = 'foo'; | ||
$sidebar = page_findnearest('sidebar'); | ||
$this->assertEquals('sidebar', $sidebar); | ||
} | ||
|
||
} |
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,40 @@ | ||
<?php | ||
|
||
class template_sidebar_test extends DokuWikiTest { | ||
function testNoSidebar() { | ||
global $ID; | ||
|
||
$ID = 'foo:bar:baz:test'; | ||
$sidebar = tpl_sidebar(false); | ||
$this->assertEquals('',$sidebar); | ||
} | ||
|
||
function testExistingSidebars() { | ||
global $ID; | ||
|
||
saveWikiText('sidebar', 'topsidebar-test', ''); | ||
|
||
$ID = 'foo:bar:baz:test'; | ||
$sidebar = tpl_sidebar(false); | ||
$this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0); | ||
|
||
$ID = 'foo'; | ||
$sidebar = tpl_sidebar(false); | ||
$this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0); | ||
|
||
saveWikiText('foo:bar:sidebar', 'bottomsidebar-test', ''); | ||
|
||
$ID = 'foo:bar:baz:test'; | ||
$sidebar = tpl_sidebar(false); | ||
$this->assertTrue(strpos($sidebar, 'bottomsidebar-test') > 0); | ||
|
||
$ID = 'foo:bar:test'; | ||
$sidebar = tpl_sidebar(false); | ||
$this->assertTrue(strpos($sidebar, 'bottomsidebar-test') > 0); | ||
|
||
$ID = 'foo'; | ||
$sidebar = tpl_sidebar(false); | ||
$this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0); | ||
} | ||
|
||
} |
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