19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"../../../Base.php");
32 public function __construct(
string $label, array $children = [])
51 return $record->getChildren();
55 C\Tree\Node\Factory $factory,
59 return $factory->simple($record->getLabel());
73 public function tree(): I\Tree\Factory
75 return new I\Tree\Factory(
76 new I\Tree\Node\Factory(),
86 $n1 =
new DataNode(
'1', [$n11, $n12]);
92 $f = $this->getUIFactory();
93 $this->tree =
$f->tree()->expandable(
$label, $recursion)
99 $html = str_replace([
"\n",
"\r",
"\t"],
"", $html);
100 $html = preg_replace(
'# {2,}#',
" ", $html);
106 $r = $this->getDefaultRenderer();
107 $html =
$r->render($this->tree);
109 $expected =
'<ul id="id_1" class="c-tree" role="tree" aria-label="label">' . $this->getInnerTreePart() .
'</ul>';
112 $this->brutallyTrimHTML($expected),
113 $this->brutallyTrimHTML($html)
119 $r = $this->getDefaultRenderer();
120 $html =
$r->render($this->tree->withIsSubTree(
true));
122 $expected = $this->getInnerTreePart();
125 $this->brutallyTrimHTML($expected),
126 $this->brutallyTrimHTML($html)
132 return '<li class="c-tree__node c-tree__node--simple expandable" role="treeitem" aria-expanded="false"> 133 <span class="c-tree__node__line"><span class="c-tree__node__label">1</span></span> 136 <li class="c-tree__node c-tree__node--simple" role="treeitem"> 137 <span class="c-tree__node__line"><span class="c-tree__node__label">1.1</span></span> 139 <li class="c-tree__node c-tree__node--simple expandable" role="treeitem" aria-expanded="false"> 140 <span class="c-tree__node__line"><span class="c-tree__node__label">1.2</span></span> 143 <li class="c-tree__node c-tree__node--simple" role="treeitem"> 144 <span class="c-tree__node__line"><span class="c-tree__node__label">1.2.1</span></span> 150 <li class="c-tree__node c-tree__node--simple" role="treeitem"> 151 <span class="c-tree__node__line"><span class="c-tree__node__label">2</span></span>
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
brutallyTrimHTML(string $html)
getChildren($record, $environment=null)
__construct(string $label, array $children=[])
Tests for the Expandable Tree.
build(C\Tree\Node\Factory $factory, $record, $environment=null)