19declare(strict_types=1);
21require_once(
"vendor/composer/vendor/autoload.php");
22require_once(__DIR__ .
"../../../../Base.php");
37 $this->node_factory =
new I\Tree\Node\Factory();
38 $icon_factory =
new I\Symbol\Icon\Factory();
39 $this->icon = $icon_factory->standard(
"",
'');
44 $html = str_replace([
"\n",
"\r",
"\t"],
"", $html);
45 $html = preg_replace(
'# {2,}#',
" ", $html);
51 $node = $this->node_factory->simple(
'simple');
52 $this->assertInstanceOf(
53 "ILIAS\\UI\\Component\\Tree\\Node\\Simple",
61 $this->expectException(ArgumentCountError::class);
62 $this->node_factory->simple();
67 $node = $this->node_factory->simple(
'label', $this->icon);
68 $this->assertInstanceOf(
69 "ILIAS\\UI\\Component\\Tree\\Node\\Simple",
76 $this->icon->setLabel(
'Different Icon Label');
77 $node = $this->node_factory->simple(
'label', $this->icon);
78 $this->assertInstanceOf(
79 "ILIAS\\UI\\Component\\Tree\\Node\\Simple",
85 #[\PHPUnit\Framework\Attributes\Depends('testConstructionWithIconAndDifferentLabels')]
88 $this->assertNotEquals($this->icon->getLabel(), $node->getLabel());
91 #[\PHPUnit\Framework\Attributes\Depends('testConstructionWithIcon')]
94 $this->assertEquals(
"label", $node->getLabel());
97 #[\PHPUnit\Framework\Attributes\Depends('testConstructionWithIcon')]
98 public function testGetIcon(
C\Tree\Node\Simple $node):
C\Tree\Node\Simple
100 $this->assertEquals($this->icon, $node->getIcon());
104 #[\PHPUnit\Framework\Attributes\Depends('testConstruction')]
107 $this->assertFalse($node->getAsyncLoading());
110 #[\PHPUnit\Framework\Attributes\Depends('testConstruction')]
113 $url =
'something.de';
114 $node = $node->withAsyncURL(
$url);
115 $this->assertTrue($node->getAsyncLoading());
116 $this->assertEquals(
$url, $node->getAsyncURL());
120 #[\PHPUnit\Framework\Attributes\Depends('testConstruction')]
123 $r = $this->getDefaultRenderer();
124 $html = $r->render($node);
127 <li
class=
"c-tree__node c-tree__node--simple" role=
"treeitem">
128 <span
class=
"c-tree__node__line">
129 <span
class=
"c-tree__node__label">
simple</span>
140 #[\PHPUnit\Framework\Attributes\Depends('testWithAsyncURL')]
143 $r = $this->getDefaultRenderer();
144 $html = $r->render($node);
147 <li
class=
"c-tree__node c-tree__node--simple expandable"
148 role=
"treeitem" aria-expanded=
"false"
149 data-async_url=
"something.de" data-async_loaded=
"false">
150 <span
class=
"c-tree__node__line">
151 <span
class=
"c-tree__node__label">
simple</span>
153 <ul role=
"group"></ul>
163 #[\PHPUnit\Framework\Attributes\Depends('testConstructionWithIcon')]
166 $r = $this->getDefaultRenderer();
167 $html = $r->render($node);
170 <li
class=
"c-tree__node c-tree__node--simple" role=
"treeitem">
171 <span
class=
"c-tree__node__line">
172 <span
class=
"c-tree__node__label">
173 <img
class=
"icon small" src=
"./assets/images/standard/icon_default.svg" alt=
""/>
190 #[\PHPUnit\Framework\Attributes\Depends('testConstructionWithIconAndDifferentLabels')]
193 $r = $this->getDefaultRenderer();
194 $html = $r->render($node);
197 <li
class=
"c-tree__node c-tree__node--simple" role=
"treeitem">
198 <span
class=
"c-tree__node__line">
199 <span
class=
"c-tree__node__label">
200 <img
class=
"icon small" src=
"./assets/images/standard/icon_default.svg" alt=
"Different Icon Label"/>
Provides common functionality for UI tests.
Tests for the SimpleNode.
testRenderingWithIconAndAltAttribute(C\Tree\Node\Simple $node)
This test is successfull if the icon label differs from the node label.
testWithAsyncURL(C\Tree\Node\Simple $node)
testRenderingWithIcon(C\Tree\Node\Simple $node)
testGetIcon(C\Tree\Node\Simple $node)
testGetDifferentLabels(C\Tree\Node\Simple $node)
testRendering(C\Tree\Node\Simple $node)
testConstructionWithIconAndDifferentLabels()
I Tree Node Factory $node_factory
C Symbol Icon Standard $icon
brutallyTrimHTML(string $html)
testConstructionWithIcon()
testRenderingWithAsync(C\Tree\Node\Simple $node)
testDefaultAsyncLoading(C\Tree\Node\Simple $node)
testGetLabel(C\Tree\Node\Simple $node)