1 <?php declare(strict_types=1);
5 require_once(
"libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../Base.php");
44 $this->button_factory =
new I\Button\Factory();
45 $this->link_factory =
new I\Link\Factory();
46 $this->icon_factory =
new I\Symbol\Icon\Factory();
47 $counter_factory =
new I\Counter\Factory();
48 $slate_factory =
new I\MainControls\Slate\Factory(
57 $this->factory =
new I\MainControls\Factory($sig_gen, $slate_factory);
59 $this->
mainbar = $this->factory->mainBar();
64 $this->assertInstanceOf(
65 "ILIAS\\UI\\Component\\MainControls\\MainBar",
72 $symbol = $this->icon_factory->custom(
'',
'');
73 return $this->button_factory->bulky($symbol,
'TestEntry',
'#');
78 $symbol = $this->icon_factory->custom(
'',
'');
79 $target =
new Data\URI(
"http://www.ilias.de");
80 return $this->link_factory->bulky($symbol,
'TestEntry', $target);
88 $mock = $this->getMockBuilder(Legacy::class)
89 ->disableOriginalConstructor()
100 ->withAdditionalEntry(
'testbtn', $btn)
101 ->withAdditionalEntry(
'testlnk', $lnk);
103 $entries = $mb->getEntries();
108 $this->assertEquals($expected, $entries);
114 $this->expectException(InvalidArgumentException::class);
115 $this->
mainbar->withAdditionalEntry(
'test',
'wrong_param');
120 $this->expectException(InvalidArgumentException::class);
123 ->withAdditionalEntry(
'test', $btn)
124 ->withAdditionalEntry(
'test', $btn);
129 $this->expectException(\TypeError::class);
130 $this->
mainbar->withAdditionalToolEntry(
'test',
'wrong_param');
135 $this->expectException(LogicException::class);
144 ->withAdditionalToolEntry(
'test', $slate);
145 $entries = $mb->getToolEntries();
146 $this->assertEquals($slate, $entries[
'test']);
151 $this->expectException(InvalidArgumentException::class);
155 ->withToolsButton($btn)
156 ->withAdditionalToolEntry(
'test', $slate)
157 ->withAdditionalToolEntry(
'test', $slate);
165 $mb = $mb->withActive(
'testbtn');
166 $this->assertEquals(
'testbtn', $mb->getActive());
171 $this->expectException(InvalidArgumentException::class);
172 $this->
mainbar->withActive(
'this-is-not-a-valid-entry');
177 $this->assertInstanceOf(Signal::class, $this->
mainbar->getEntryClickSignal());
178 $this->assertInstanceOf(Signal::class, $this->
mainbar->getToolsClickSignal());
179 $this->assertInstanceOf(Signal::class, $this->
mainbar->getToolsRemovalSignal());
180 $this->assertInstanceOf(Signal::class, $this->
mainbar->getDisengageAllSignal());
185 $factory =
new class extends NoUIFactory {
191 public function button() : C\Button\Factory
195 public function symbol() : C\Symbol\Factory
197 $f_icon =
new I\Symbol\Icon\Factory();
198 $f_glyph =
new I\Symbol\Glyph\Factory();
199 $f_avatar =
new I\Symbol\Avatar\Factory();
201 return new I\Symbol\Factory($f_icon, $f_glyph, $f_avatar);
203 public function mainControls() : C\MainControls\Factory
206 $counter_factory =
new I\Counter\Factory();
207 $symbol_factory =
new I\Symbol\Factory(
212 $slate_factory =
new I\MainControls\Slate\Factory($sig_gen, $counter_factory, $symbol_factory);
213 return new I\MainControls\Factory($sig_gen, $slate_factory);
215 public function legacy($content) : C\Legacy\Legacy
218 return new I\Legacy\Legacy($content, $sig_gen);
228 $icon = $this->icon_factory->custom(
'',
'');
230 $sf = $this->factory->slate();
231 $slate = $sf->combined(
'1', $icon)
232 ->withAdditionalEntry(
233 $sf->combined(
'1.1', $icon)
234 ->withAdditionalEntry(
235 $sf->combined(
'1.1.1', $icon)
239 $toolslate = $sf->legacy(
'Help', $icon,
new I\
Legacy\
Legacy(
'Help',
new I\SignalGenerator()));
241 $mb = $this->factory->mainBar()
242 ->withAdditionalEntry(
'test1', $this->
getButton())
243 ->withAdditionalEntry(
'test2', $this->
getButton())
244 ->withAdditionalEntry(
'slate', $slate)
246 ->withAdditionalToolEntry(
'tool1', $toolslate);
248 $html = $r->render($mb);
251 <div
class=
"il-maincontrols-mainbar" id=
"id_16">
252 <nav
class=
"il-mainbar" aria-label=
"mainbar_aria_label">
254 <div
class=
"il-mainbar-tools-button">
255 <button
class=
"btn btn-bulky" id=
"id_14"><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">TestEntry</span></button>
258 <div
class=
"il-mainbar-triggers">
259 <ul
class=
"il-mainbar-entries" role=
"menubar" style=
"visibility: hidden">
260 <li role=
"none"><button
class=
"btn btn-bulky" data-action=
"#" id=
"id_1" role=
"menuitem" ><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">TestEntry</span></button></li>
261 <li role=
"none"><button
class=
"btn btn-bulky" data-action=
"#" id=
"id_2" role=
"menuitem" ><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">TestEntry</span></button></li>
262 <li role=
"none"><button
class=
"btn btn-bulky" id=
"id_3" role=
"menuitem" ><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">1</span></button></li>
263 <li role=
"none"><button
class=
"btn btn-bulky" id=
"id_9" role=
"menuitem" ><span
class=
"glyph" aria-label=
"show_more" role=
"img"><span
class=
"glyphicon glyphicon-option-horizontal" aria-hidden=
"true"></span></span><span
class=
"bulky-label">mainbar_more_label</span></button></li>
268 <div
class=
"il-mainbar-slates">
269 <div
class=
"il-mainbar-tools-entries">
270 <ul
class=
"il-mainbar-tools-entries-bg" role=
"menubar">
271 <li
class=
"il-mainbar-tool-trigger-item" role=
"none">
272 <button
class=
"btn btn-bulky" id=
"id_11" role=
"menuitem"><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">Help</span></button>
276 <div
class=
"il-maincontrols-slate disengaged" id=
"id_8" data-depth-level=
"1" role=
"menu">
277 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content">
278 <button
class=
"btn btn-bulky" id=
"id_4" ><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">1.1</span></button>
280 <div
class=
"il-maincontrols-slate disengaged" id=
"id_7" data-depth-level=
"2">
281 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content">
282 <button
class=
"btn btn-bulky" id=
"id_5" ><img
class=
"icon custom small" src=
"" alt=
""/><span
class=
"bulky-label">1.1.1</span></button>
284 <div
class=
"il-maincontrols-slate disengaged" id=
"id_6" data-depth-level=
"3">
285 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content"></div>
293 <div
class=
"il-maincontrols-slate disengaged" id=
"id_10" data-depth-level=
"1" role=
"menu">
294 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content"></div>
297 <div
class=
"il-maincontrols-slate disengaged" id=
"id_13" data-depth-level=
"1" role=
"menu">
298 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content">Help</div>
302 <div
class=
"il-mainbar-close-slates">
303 <button
class=
"btn btn-bulky" id=
"id_15" >
304 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
305 <span
class=
"bulky-label">
close</span></button>
Provides common functionality for UI tests.
testAddToolEntryWithoutToolsButton()
testDisallowedToolEntry()
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
testDouplicateIdToolEntry()
testActive(C\MainControls\MainBar $mb)
testAddEntry
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])