Add directory listing syntax
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled
This commit is contained in:
@@ -233,4 +233,34 @@ class plugin_luxtools_test extends DokuWikiTest
|
||||
$this->assertStringContainsString('Open here', $xhtml);
|
||||
$this->assertStringContainsString('data-path="/tmp/somewhere"', $xhtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks that the directory syntax renders a flat table,
|
||||
* listing both folders and files.
|
||||
*/
|
||||
public function test_directory_table_flat()
|
||||
{
|
||||
$instructions = p_get_instructions('{{directory>' . TMP_DIR . '/filelistdata/&direct=1}}');
|
||||
$xhtml = p_render('xhtml', $instructions, $info);
|
||||
|
||||
$doc = new Document();
|
||||
$doc->html($xhtml);
|
||||
|
||||
$structure = [
|
||||
'div.filetools-plugin' => 1,
|
||||
'div.filetools-plugin table' => 1,
|
||||
'div.filetools-plugin table > tbody > tr' => 3,
|
||||
'a.filetools-open' => 1,
|
||||
];
|
||||
$this->structureCheck($doc, $structure);
|
||||
|
||||
// Should list the top-level entries, but not recurse into exampledir
|
||||
$this->assertStringContainsString('example.txt', $xhtml);
|
||||
$this->assertStringContainsString('exampleimage.png', $xhtml);
|
||||
$this->assertStringContainsString('exampledir', $xhtml);
|
||||
$this->assertStringNotContainsString('example2.txt', $xhtml);
|
||||
|
||||
// Directory row should trigger the same behaviour as {{open>...}} for that folder
|
||||
$this->assertStringContainsString('data-path="' . TMP_DIR . '/filelistdata/exampledir"', $xhtml);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user