Tests for the Main Bar.
More...
Tests for the Main Bar.
Definition at line 16 of file MainBarTest.php.
◆ brutallyTrimHTML()
MainBarTest::brutallyTrimHTML |
( |
|
$html | ) |
|
Definition at line 196 of file MainBarTest.php.
Referenced by testRendering().
198 $html = str_replace([
"\n",
"\r",
"\t"],
"", $html);
199 $html = preg_replace(
'# {2,}#',
" ", $html);
200 $html = preg_replace(
'/<!--(.|\s)*?-->/',
'', $html);
◆ getButton()
MainBarTest::getButton |
( |
| ) |
|
|
protected |
◆ getLink()
Definition at line 53 of file MainBarTest.php.
Referenced by testAddEntry().
55 $symbol = $this->icon_factory->custom(
'',
'');
56 $target = new \ILIAS\Data\URI(
"http://www.ilias.de");
57 return $this->link_factory->bulky($symbol,
'TestEntry', $target);
◆ getSlate()
MainBarTest::getSlate |
( |
| ) |
|
|
protected |
◆ getUIFactory()
MainBarTest::getUIFactory |
( |
| ) |
|
Definition at line 159 of file MainBarTest.php.
References $factory, and legacy().
162 public function button()
164 return $this->button_factory;
166 public function symbol() :
C\Symbol\Factory
168 $f_icon =
new I\Symbol\Icon\Factory();
169 $f_glyph =
new I\Symbol\Glyph\Factory();
170 $f_avatar =
new I\Symbol\Avatar\Factory();
172 return new I\Symbol\Factory($f_icon, $f_glyph, $f_avatar);
174 public function mainControls() :
C\MainControls\Factory
177 $counter_factory =
new I\Counter\Factory();
178 $symbol_factory =
new I\Symbol\Factory(
179 new I\Symbol\Icon\Factory(),
180 new I\Symbol\Glyph\Factory(),
181 new I\Symbol\Avatar\Factory()
183 $slate_factory =
new I\MainControls\Slate\Factory($sig_gen, $counter_factory, $symbol_factory);
184 return new I\MainControls\Factory($sig_gen, $slate_factory);
186 public function legacy($legacy)
189 return new I\Legacy\Legacy($legacy, $sig_gen);
192 $factory->button_factory = $this->button_factory;
◆ setUp()
Definition at line 18 of file MainBarTest.php.
References mainbar().
21 $this->button_factory =
new I\Button\Factory($sig_gen);
22 $this->link_factory =
new I\Link\Factory();
23 $this->icon_factory =
new I\Symbol\Icon\Factory();
24 $counter_factory =
new I\Counter\Factory();
25 $slate_factory =
new I\MainControls\Slate\Factory(
29 new I\Symbol\Icon\Factory(),
30 new I\Symbol\Glyph\Factory(),
31 new I\Symbol\Avatar\Factory()
34 $this->factory =
new I\MainControls\Factory($sig_gen, $slate_factory);
36 $this->
mainbar = $this->factory->mainBar();
◆ testActive()
MainBarTest::testActive |
( |
|
$mb | ) |
|
testAddEntry
Definition at line 138 of file MainBarTest.php.
140 $mb = $mb->withActive(
'testbtn');
141 $this->assertEquals(
'testbtn', $mb->getActive());
◆ testAddEntry()
MainBarTest::testAddEntry |
( |
| ) |
|
Definition at line 71 of file MainBarTest.php.
References getButton(), getLink(), and mainbar().
76 ->withAdditionalEntry(
'testbtn', $btn)
77 ->withAdditionalEntry(
'testlnk', $lnk);
79 $entries = $mb->getEntries();
84 $this->assertEquals($expected, $entries);
◆ testAddToolEntry()
MainBarTest::testAddToolEntry |
( |
| ) |
|
◆ testAddToolEntryWithoutToolsButton()
MainBarTest::testAddToolEntryWithoutToolsButton |
( |
| ) |
|
◆ testConstruction()
MainBarTest::testConstruction |
( |
| ) |
|
Definition at line 39 of file MainBarTest.php.
References mainbar().
41 $this->assertInstanceOf(
42 "ILIAS\\UI\\Component\\MainControls\\MainBar",
◆ testDisallowedEntry()
MainBarTest::testDisallowedEntry |
( |
| ) |
|
Definition at line 88 of file MainBarTest.php.
References mainbar().
90 $this->expectException(\InvalidArgumentException::class);
91 $mb = $this->
mainbar->withAdditionalEntry(
'test',
'wrong_param');
◆ testDisallowedToolEntry()
MainBarTest::testDisallowedToolEntry |
( |
| ) |
|
Definition at line 103 of file MainBarTest.php.
References mainbar().
105 $this->expectException(\TypeError::class);
106 $mb = $this->
mainbar->withAdditionalToolEntry(
'test',
'wrong_param');
◆ testDouplicateIdEntry()
MainBarTest::testDouplicateIdEntry |
( |
| ) |
|
Definition at line 94 of file MainBarTest.php.
References getButton(), and mainbar().
96 $this->expectException(\InvalidArgumentException::class);
99 ->withAdditionalEntry(
'test', $btn)
100 ->withAdditionalEntry(
'test', $btn);
◆ testDouplicateIdToolEntry()
MainBarTest::testDouplicateIdToolEntry |
( |
| ) |
|
Definition at line 125 of file MainBarTest.php.
References getButton(), getSlate(), and mainbar().
127 $this->expectException(\InvalidArgumentException::class);
130 $mb = $this->
mainbar->withToolsButton($btn)
131 ->withAdditionalToolEntry(
'test', $slate)
132 ->withAdditionalToolEntry(
'test', $slate);
◆ testRendering()
MainBarTest::testRendering |
( |
| ) |
|
Definition at line 204 of file MainBarTest.php.
References brutallyTrimHTML(), close(), getButton(), ILIAS_UI_TestBase\getDefaultRenderer(), and more().
207 $icon = $this->icon_factory->custom(
'',
'');
209 $sf = $this->factory->slate();
210 $slate = $sf->combined(
'1', $icon,
'')
211 ->withAdditionalEntry(
212 $sf->combined(
'1.1', $icon,
'')
213 ->withAdditionalEntry(
214 $sf->combined(
'1.1.1', $icon,
'')
218 $mb = $this->factory->mainBar()
220 $this->button_factory->bulky($icon,
'more',
'')
222 ->withAdditionalEntry(
'test1', $this->
getButton())
223 ->withAdditionalEntry(
'test2', $this->
getButton())
224 ->withAdditionalEntry(
'slate', $slate);
226 $html = $r->render($mb);
229 <div
class=
"il-maincontrols-mainbar" id=
"id_12">
230 <nav
class=
"il-mainbar" aria-label=
"mainbar_aria_label">
231 <div
class=
"il-mainbar-triggers">
232 <div
class=
"il-mainbar-entries" role=
"menubar" style=
"visibility: hidden">
233 <button
class=
"btn btn-bulky" data-action=
"#" id=
"id_1" ><div
class=
"icon custom small" aria-label=
""><img src=
"" /></div><span
class=
"bulky-label">TestEntry</span></button>
234 <button
class=
"btn btn-bulky" data-action=
"#" id=
"id_2" ><div
class=
"icon custom small" aria-label=
""><img src=
"" /></div><span
class=
"bulky-label">TestEntry</span></button>
235 <button
class=
"btn btn-bulky" id=
"id_3" role=
"menuitem" aria-haspopup=
"true" ><div
class=
"icon custom small" aria-label=
""><img src=
"" /></div><span
class=
"bulky-label">1</span></button>
236 <button
class=
"btn btn-bulky" id=
"id_9" role=
"menuitem" aria-haspopup=
"true" ><span
class=
"glyph" aria-label=
"show_more"><span
class=
"glyphicon glyphicon-option-horizontal" aria-hidden=
"true"></span></span><span
class=
"bulky-label">
more</span></button>
241 <div
class=
"il-mainbar-slates">
242 <div
class=
"il-mainbar-tools-entries">
243 <div
class=
"il-mainbar-tools-entries-bg"></div>
245 <div
class=
"il-maincontrols-slate disengaged" id=
"id_8" data-depth-level=
"1" role=
"menu">
246 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content">
247 <button
class=
"btn btn-bulky" id=
"id_4" ><div
class=
"icon custom small" aria-label=
""><img src=
"" /></div><span
class=
"bulky-label">1.1</span></button>
249 <div
class=
"il-maincontrols-slate disengaged" id=
"id_7" data-depth-level=
"2">
250 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content">
251 <button
class=
"btn btn-bulky" id=
"id_5" ><div
class=
"icon custom small" aria-label=
""><img src=
"" /></div><span
class=
"bulky-label">1.1.1</span></button>
253 <div
class=
"il-maincontrols-slate disengaged" id=
"id_6" data-depth-level=
"3">
254 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content"></div>
262 <div
class=
"il-maincontrols-slate disengaged" id=
"id_10" data-depth-level=
"1" role=
"menu">
263 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content"></div>
266 <div
class=
"il-mainbar-close-slates">
267 <button
class=
"btn btn-bulky" id=
"id_11" ><span
class=
"glyph" href=
"#" aria-label=
"back"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span><span
class=
"bulky-label">
close</span></button>
getDefaultRenderer(JavaScriptBinding $js_binding=null)
◆ testSignalsPresent()
MainBarTest::testSignalsPresent |
( |
| ) |
|
Definition at line 151 of file MainBarTest.php.
References mainbar().
153 $this->assertInstanceOf(Signal::class, $this->
mainbar->getEntryClickSignal());
154 $this->assertInstanceOf(Signal::class, $this->
mainbar->getToolsClickSignal());
155 $this->assertInstanceOf(Signal::class, $this->
mainbar->getToolsRemovalSignal());
156 $this->assertInstanceOf(Signal::class, $this->
mainbar->getDisengageAllSignal());
◆ testWithInvalidActive()
MainBarTest::testWithInvalidActive |
( |
| ) |
|
Definition at line 144 of file MainBarTest.php.
References mainbar().
146 $this->expectException(\InvalidArgumentException::class);
148 ->withActive(
'this-is-not-a-valid-entry');
The documentation for this class was generated from the following file: