5 require_once(
"libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../Base.php");
8 use \ILIAS\UI\Component as
C;
9 use \ILIAS\UI\Implementation as
I;
10 use \ILIAS\UI\Implementation\Component\MainControls\Slate\Legacy;
11 use \ILIAS\UI\Component\Signal;
20 $sig_gen =
new I\Component\SignalGenerator();
21 $this->button_factory =
new I\Component\Button\Factory($sig_gen);
22 $this->icon_factory =
new I\Component\Symbol\Icon\Factory();
23 $this->counter_factory =
new I\Component\Counter\Factory();
25 $slate_factory =
new I\Component\MainControls\Slate\Factory(
27 $this->counter_factory,
35 $this->factory =
new I\Component\MainControls\Factory($sig_gen, $slate_factory);
36 $this->
metabar = $this->factory->metabar();
41 $this->assertInstanceOf(
42 "ILIAS\\UI\\Component\\MainControls\\MetaBar",
49 $symbol = $this->icon_factory->custom(
'',
'');
50 return $this->button_factory->bulky($symbol,
'TestEntry',
'#');
55 $mock = $this->getMockBuilder(Legacy::class)
56 ->disableOriginalConstructor()
57 ->setMethods([
"transformToLegacyComponent"])
60 $mock->method(
'transformToLegacyComponent')->willReturn(
'content');
69 ->withAdditionalEntry(
'button', $button)
70 ->withAdditionalEntry(
'slate', $slate);
71 $entries = $mb->getEntries();
72 $this->assertEquals($button, $entries[
'button']);
73 $this->assertEquals($slate, $entries[
'slate']);
78 $this->expectException(\InvalidArgumentException::class);
79 $mb = $this->
metabar->withAdditionalEntry(
'test',
'wrong_param');
84 $this->assertInstanceOf(Signal::class, $this->
metabar->getEntryClickSignal());
89 $factory =
new class extends NoUIFactory {
90 public function button()
92 return $this->button_factory;
94 public function mainControls() : C\MainControls\Factory
96 return $this->mc_factory;
98 public function symbol() : C\Symbol\Factory
100 return new I\Component\Symbol\Factory(
106 public function counter() : C\Counter\Factory
108 return $this->counter_factory;
111 $factory->button_factory = $this->button_factory;
113 $factory->counter_factory = $this->counter_factory;
119 $html = str_replace([
"\n",
"\r",
"\t"],
"", $html);
120 $html = preg_replace(
'# {2,}#',
" ", $html);
121 $html = preg_replace(
'/<!--(.|\s)*?-->/',
'', $html);
132 ->withAdditionalEntry(
'button', $button)
133 ->withAdditionalEntry(
'button2', $button);
135 $html = $r->render($mb);
138 <div
class=
"il-maincontrols-metabar" id=
"id_5" role=
"menubar" aria-label=
"metabar_aria_label">
139 <div
class=
"il-metabar-entries" style=
"visibility: hidden">
140 <button
class=
"btn btn-bulky" data-action=
"#" id=
"id_1" >
141 <div
class=
"icon custom small" aria-label=
"">
144 <span
class=
"bulky-label">TestEntry</span>
146 <button
class=
"btn btn-bulky" data-action=
"#" id=
"id_2" >
147 <div
class=
"icon custom small" aria-label=
"">
150 <span
class=
"bulky-label">TestEntry</span>
152 <button
class=
"btn btn-bulky" id=
"id_3" role=
"menuitem" aria-haspopup=
"true" aria-pressed=
"false" >
153 <span
class=
"glyph" aria-label=
"disclose">
154 <span
class=
"glyphicon glyphicon-option-vertical" aria-hidden=
"true"></span>
155 <span
class=
"il-counter">
156 <span
class=
"badge badge-notify il-counter-status" style=
"display:none">0</span>
158 <span
class=
"il-counter">
159 <span
class=
"badge badge-notify il-counter-novelty" style=
"display:none">0</span>
162 <span
class=
"bulky-label">
more</span>
165 <div
class=
"il-metabar-slates">
166 <div
class=
"il-maincontrols-slate disengaged" id=
"id_4" role=
"menu">
167 <div
class=
"il-maincontrols-slate-content" data-replace-marker=
"content"></div>
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Provides common functionality for UI tests.