3declare(strict_types=1);
20require_once(__DIR__ .
'/../../../../libs/composer/vendor/autoload.php');
21require_once(__DIR__ .
'/../../Base.php');
33 return new I\Component\Item\Factory();
40 $shy =
$f->shy(
'shy');
42 $this->assertInstanceOf(
'ILIAS\\UI\\Component\\Item\\Shy', $shy);
48 $c =
$f->shy(
'shy')->withDescription(
'This is a shy');
49 $this->assertEquals(
'This is a shy',
$c->getDescription());
55 $c =
$f->shy(
'shy')->withProperties([
'name' =>
'value']);
56 $this->assertEquals([
'name' =>
'value'],
$c->getProperties());
69 $c =
$f->shy(
'shy')->withLeadIcon(
72 $this->assertInstanceOf(
I\
Component\Symbol\Icon\Icon::class,
$c->getLeadIcon());
80<div
class=
"il-item il-item-shy">
82 <div
class=
"il-item-title">shy</div>
95 $c = $this->
getFactory()->shy(
'noid"><script>alert(\'CRITICAL\')</script');
98<div
class=
"il-item il-item-shy">
100 <div
class=
"il-item-title">noid
"><script>alert('CRITICAL')</script</div>
105 $this->assertHTMLEquals(
106 $this->brutallyTrimHTML($expected),
107 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
111 public function test_render_with_description(): void
113 $c = $this->getFactory()->shy('shy')->withDescription('This is a shy');
116<div class="il-item il-item-shy
">
117 <div class="content
">
118 <div class="il-item-title
">shy</div>
119 <div class="il-item-description
">This is a shy</div>
124 $this->assertHTMLEquals(
125 $this->brutallyTrimHTML($expected),
126 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
130 public function test_render_with_property(): void
132 $c = $this->getFactory()->shy('shy')->withProperties(['name' => 'value']);
135<div class="il-item il-item-shy
">
136 <div class="content
">
137 <div class="il-item-title
">shy</div>
138 <hr class="il-item-divider
" />
139 <div class="il-item-properties
">
140 <div class="il-item-
property-name
">name</div>
141 <div class="il-item-
property-value
">value</div>
147 $this->assertHTMLEquals(
148 $this->brutallyTrimHTML($expected),
149 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
154 public function test_render_with_lead_icon(): void
156 $c = $this->getFactory()->shy('shy')->withLeadIcon(
157 new I\Component\Symbol\Icon\Standard('name', 'aria_label', 'small', false)
161<div class="il-item il-item-shy
">
162 <img class="icon name
small" src="./templates/
default/images/icon_default.svg
" alt="aria_label
" />
163 <div class="content
">
164 <div class="il-item-title
">shy</div>
169 $this->assertHTMLEquals(
170 $this->brutallyTrimHTML($expected),
171 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
175 public function test_render_with_close(): void
177 $c = $this->getFactory()->shy('shy')->withClose(new I\Component\Button\Close());
180<div class="il-item il-item-shy
">
181 <div class="content
">
182 <div class="il-item-title
">shy</div>
183 <button type="button
" class="close" aria-label="close">
184 <span aria-hidden="true">×</span>
191 $this->brutallyTrimHTML($expected),
192 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
Provides common functionality for UI tests.
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_implements_factory_interface()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.