5require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ .
"/../../Base.php");
8use \ILIAS\UI\Component as
C;
9use \ILIAS\UI\Implementation as
I;
10use \ILIAS\UI\Implementation\Component\SignalGenerator;
20 return "Component Dummy";
32 public function panelSecondary()
34 return new I\Component\Panel\Secondary\Factory();
36 public function dropdown()
38 return new I\Component\Dropdown\Factory();
40 public function viewControl()
44 public function button()
46 return new I\Component\Button\Factory();
48 public function symbol() : C\Symbol\Factory
50 return new I\Component\Symbol\Factory(
51 new I\Component\Symbol\Icon\Factory(),
52 new I\Component\Symbol\Glyph\Factory(),
53 new I\Component\Symbol\Avatar\Factory()
65 return new I\Component\Panel\Factory(
66 $this->createMock(
C\Panel\Listing\Factory::class)
74 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Panel\\Factory",
$f);
75 $this->assertInstanceOf(
76 "ILIAS\\UI\\Component\\Panel\\Standard",
79 $this->assertInstanceOf(
80 "ILIAS\\UI\\Component\\Panel\\Sub",
83 $this->assertInstanceOf(
84 "ILIAS\\UI\\Component\\Panel\\Report",
94 $this->assertEquals($p->getTitle(),
"Title");
101 $p =
$f->standard(
"Title", array(
$c));
103 $this->assertEquals($p->getContent(), array(
$c));
112 $actions =
new I\Component\Dropdown\Standard(array(
113 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
114 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
117 $p = $p->withActions($actions);
119 $this->assertEquals($p->getActions(), $actions);
128 $actions =
new I\Component\Dropdown\Standard(array(
129 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
130 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
133 $p = $p->withActions($actions);
135 $this->assertEquals($p->getActions(), $actions);
144 $card =
new I\Component\Card\Card(
"Card Title");
146 $p = $p->withCard($card);
148 $this->assertEquals($p->getCard(), $card);
155 $p =
$f->report(
"Title", array($sub));
157 $this->assertEquals($p->getTitle(),
"Title");
164 $p =
$f->report(
"Title", $sub);
166 $this->assertEquals($p->getContent(), array($sub));
173 $actions =
new I\Component\Dropdown\Standard(array(
174 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
175 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
178 $p =
$f->standard(
"Title", array())->withActions($actions);
180 $html = $r->render($p);
182 $expected_html = <<<EOT
183<div
class=
"panel panel-primary panel-flex">
184 <div
class=
"panel-heading ilHeader">
186 <div
class=
"dropdown"><button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false"> <span
class=
"caret"></span></button>
187 <ul
class=
"dropdown-menu">
188 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
189 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
193 <div
class=
"panel-body"></div>
204 $actions =
new I\Component\Dropdown\Standard(array(
205 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
206 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
209 $p = $fp->sub(
"Title", array())->withActions($actions);
210 $card =
new I\Component\Card\Card(
"Card Title");
211 $p = $p->withCard($card);
214 $expected_html = <<<EOT
215<div
class=
"panel panel-sub panel-flex">
216 <div
class=
"panel-heading ilBlockHeader">
218 <div
class=
"dropdown"><button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false"> <span
class=
"caret"></span></button>
219 <ul
class=
"dropdown-menu">
220 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
221 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
225 <div
class=
"panel-body">
227 <div
class=
"col-sm-8"></div>
228 <div
class=
"col-sm-4">
229 <div
class=
"il-card thumbnail">
230 <div
class=
"card-no-highlight"></div>
231 <div
class=
"caption card-title">Card
Title</div>
246 $sub = $fp->sub(
"Title", array());
247 $card =
new I\Component\Card\Card(
"Card Title");
248 $sub = $sub->withCard($card);
249 $report = $fp->report(
"Title", $sub);
253 $expected_html = <<<EOT
254<div
class=
"panel panel-primary il-panel-report panel-flex">
255 <div
class=
"panel-heading ilHeader">
258 <div
class=
"panel-body">
259 <div
class=
"panel panel-sub panel-flex">
260 <div
class=
"panel-heading ilBlockHeader">
263 <div
class=
"panel-body"><div
class=
"row">
264 <div
class=
"col-sm-8"></div>
265 <div
class=
"col-sm-4">
266 <div
class=
"il-card thumbnail">
267 <div
class=
"card-no-highlight"></div>
268 <div
class=
"caption card-title">Card
Title</div>
287 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options);
289 $p =
$f->standard(
"Title", [])
290 ->withViewControls([$sortation]);
293 $this->assertEquals($p->getViewControls(), [$sortation]);
302 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options);
308 $p =
$f->standard(
"Title", [])
309 ->withViewControls([$sortation]);
312 $html = $r->render($p);
314 $expected_html = <<<EOT
315<div
class=
"panel panel-primary panel-flex">
316 <div
class=
"panel-heading ilHeader">
318 <div
class=
"il-viewcontrol-sortation" id=
"id_1">
319<div
class=
"dropdown"><button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false" > <span
class=
"caret"></span></button>
320<ul
class=
"dropdown-menu">
321 <li><button
class=
"btn btn-link" data-action=
"?sortation=a" id=
"id_2">
A</button>
323 <li><button
class=
"btn btn-link" data-action=
"?sortation=b" id=
"id_3">
B</button>
329 <div
class=
"panel-body"></div>
337 $pagination = $this->
getUIFactory()->viewControl()->pagination()
338 ->withTargetURL(
'http://ilias.de',
'page')
339 ->withTotalEntries(10)
341 ->withCurrentPage(1);
347 $p =
$f->standard(
"Title", [])
348 ->withViewControls([$pagination]);
350 $html = $r->render($p);
352 $expected_html = <<<EOT
353<div
class=
"panel panel-primary panel-flex">
354 <div
class=
"panel-heading ilHeader">
356 <div
class=
"il-viewcontrol-pagination">
357<span
class=
"browse previous"><a
class=
"glyph" href=
"http://ilias.de?page=0" aria-label=
"back">
358<span
class=
"glyphicon
359 glyphicon-chevron-left
360" aria-hidden=
"true"></span>
363 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=0" id=
"id_1">1</button>
364 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"http://ilias.de?page=1" id=
"id_2">2</button>
365 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=2" id=
"id_3">3</button>
366 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=3" id=
"id_4">4</button>
367 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=4" id=
"id_5">5</button>
368<span
class=
"browse next"><a
class=
"glyph" href=
"http://ilias.de?page=2" aria-label=
"next">
369<span
class=
"glyphicon
370 glyphicon-chevron-right
371" aria-hidden=
"true"></span>
377 <div
class=
"panel-body"></div>
An exception for terminatinating execution or to throw for unit testing.
getCanonicalName()
Get the canonical name of the component.
Provides common functionality for UI tests.
assertHTMLEquals($expected_html_as_string, $html_as_string)
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Test on button implementation.
test_standard_with_actions()
test_render_with_pagination()
test_standard_get_content()
test_with_view_controls()
test_report_get_content()
test_render_with_sortation()
test_standard_get_title()
test_implements_factory_interface()
A component is the most general form of an entity in the UI.
Class ChatMainBarProvider \MainMenu\Provider.