19declare(strict_types=1);
21require_once(__DIR__ .
'/../../../../../../vendor/composer/vendor/autoload.php');
22require_once(__DIR__ .
'/../../Base.php');
34 return new I\Component\Item\Factory();
41 $shy =
$f->shy(
'shy');
43 $this->assertInstanceOf(
'ILIAS\\UI\\Component\\Item\\Shy', $shy);
49 $c =
$f->shy(
'shy')->withDescription(
'This is a shy');
50 $this->assertEquals(
'This is a shy',
$c->getDescription());
56 $c =
$f->shy(
'shy')->withProperties([
'name' =>
'value']);
57 $this->assertEquals([
'name' =>
'value'],
$c->getProperties());
70 $c =
$f->shy(
'shy')->withLeadIcon(
73 $this->assertInstanceOf(
I\
Component\Symbol\Icon\Icon::class,
$c->getLeadIcon());
81<div
class=
"il-item il-item-shy">
83 <div
class=
"il-item-title">shy</div>
88 $this->assertHTMLEquals(
89 $this->brutallyTrimHTML($expected),
90 $this->brutallyTrimHTML($this->getDefaultRenderer()->render(
$c))
96 $c = $this->
getFactory()->shy(
'noid"><script>alert(\'CRITICAL\')</script');
99<div
class=
"il-item il-item-shy">
100 <div
class=
"content">
101 <div
class=
"il-item-title">noid
"><script>alert('CRITICAL')</script</div>
106 $this->assertHTMLEquals(
107 $this->brutallyTrimHTML($expected),
108 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
112 public function testRenderWithDescription(): void
114 $c = $this->getFactory()->shy('shy')->withDescription('This is a shy');
117<div class="il-item il-item-shy
">
118 <div class="content
">
119 <div class="il-item-title
">shy</div>
120 <div class="il-item-description
">This is a shy</div>
125 $this->assertHTMLEquals(
126 $this->brutallyTrimHTML($expected),
127 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
131 public function testRenderWithProperty(): void
133 $c = $this->getFactory()->shy('shy')->withProperties(['name' => 'value']);
136<div class="il-item il-item-shy
">
137 <div class="content
">
138 <div class="il-item-title
">shy</div>
139 <hr class="il-item-divider
" />
140 <div class="il-item-properties
">
141 <div class="il-item-
property-name
">name</div>
142 <div class="il-item-
property-value
">value</div>
148 $this->assertHTMLEquals(
149 $this->brutallyTrimHTML($expected),
150 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
155 public function testRenderWithLeadIcon(): void
157 $c = $this->getFactory()->shy('shy')->withLeadIcon(
158 new I\Component\Symbol\Icon\Standard('name', 'aria_label', 'small', false)
162<div class="il-item il-item-shy
">
163 <img class="icon name
small" src="./assets/images/
standard/icon_default.svg
" alt="aria_label
" />
164 <div class="content
">
165 <div class="il-item-title
">shy</div>
170 $this->assertHTMLEquals(
171 $this->brutallyTrimHTML($expected),
172 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
176 public function testRenderWithClose(): void
178 $c = $this->getFactory()->shy('shy')->withClose(new I\Component\Button\Close());
181<div class="il-item il-item-shy
">
182 <div class="content
">
183 <div class="il-item-title
">shy</div>
185 <span aria-hidden="true">×</span>
192 $this->brutallyTrimHTML($expected),
193 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
Provides common functionality for UI tests.
testImplementsFactoryInterface()
button(string $caption, string $cmd)