3declare(strict_types=1);
21require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
22require_once(__DIR__ .
"/../../Base.php");
38 return "Component Dummy";
50 public function panelSecondary(): I\Component\Panel\Secondary\Factory
52 return new I\Component\Panel\Secondary\Factory();
54 public function dropdown(): I\Component\Dropdown\Factory
56 return new I\Component\Dropdown\Factory();
58 public function viewControl(): I\Component\ViewControl\Factory
62 public function button(): I\Component\Button\Factory
64 return new I\Component\Button\Factory();
66 public function symbol(): C\Symbol\Factory
68 return new I\Component\Symbol\Factory(
79 return new I\Component\Panel\Factory(
80 $this->createMock(
C\Panel\Listing\Factory::class)
88 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Panel\\Factory",
$f);
89 $this->assertInstanceOf(
90 "ILIAS\\UI\\Component\\Panel\\Standard",
93 $this->assertInstanceOf(
94 "ILIAS\\UI\\Component\\Panel\\Sub",
97 $this->assertInstanceOf(
98 "ILIAS\\UI\\Component\\Panel\\Report",
108 $this->assertEquals(
"Title", $p->getTitle());
115 $p =
$f->standard(
"Title", array(
$c));
117 $this->assertEquals($p->getContent(), array(
$c));
126 $actions =
new I\Component\Dropdown\Standard(array(
131 $p = $p->withActions($actions);
133 $this->assertEquals($p->getActions(), $actions);
142 $actions =
new I\Component\Dropdown\Standard(array(
147 $p = $p->withActions($actions);
149 $this->assertEquals($p->getActions(), $actions);
158 $card =
new I\Component\Card\Card(
"Card Title");
160 $p = $p->withFurtherInformation($card);
162 $this->assertEquals($p->getFurtherInformation(), $card);
171 $legacy =
new I\Component\Legacy\Legacy(
"Legacy content",
new SignalGenerator());
172 $secondary =
new I\Component\Panel\Secondary\Legacy(
"Legacy panel title", $legacy);
174 $p = $p->withFurtherInformation($secondary);
176 $this->assertEquals($p->getFurtherInformation(), $secondary);
183 $p =
$f->report(
"Title", array($sub));
185 $this->assertEquals(
"Title", $p->getTitle());
192 $p =
$f->report(
"Title", [$sub]);
194 $this->assertEquals($p->getContent(), array($sub));
201 $actions =
new I\Component\Dropdown\Standard(array(
206 $p =
$f->standard(
"Title", array())->withActions($actions);
208 $html = $r->render($p);
210 $expected_html = <<<EOT
211<div
class=
"panel panel-primary panel-flex">
212 <div
class=
"panel-heading ilHeader">
214 <div
class=
"dropdown"><button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" id=
"id_3" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_3_menu"> <span
class=
"caret"></span></button>
215 <ul
id=
"id_3_menu" class=
"dropdown-menu">
216 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
217 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
221 <div
class=
"panel-body"></div>
232 $actions =
new I\Component\Dropdown\Standard(array(
237 $p = $fp->sub(
"Title", array())->withActions($actions);
238 $card =
new I\Component\Card\Card(
"Card Title");
240 $p = $p->withFurtherInformation($card);
243 $expected_html = <<<EOT
244<div
class=
"panel panel-sub panel-flex">
245 <div
class=
"panel-heading ilBlockHeader">
247 <div
class=
"dropdown"><button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" id=
"id_3" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_3_menu"> <span
class=
"caret"></span></button>
248 <ul
id=
"id_3_menu" class=
"dropdown-menu">
249 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
250 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
254 <div
class=
"panel-body">
256 <div
class=
"col-sm-8"></div>
257 <div
class=
"col-sm-4">
258 <div
class=
"il-card thumbnail">
259 <div
class=
"card-no-highlight"></div>
260 <div
class=
"caption card-title">Card
Title</div>
276 $p = $fp->sub(
"Title", array());
277 $legacy =
new I\Component\Legacy\Legacy(
"Legacy content",
new SignalGenerator());
278 $secondary =
new I\Component\Panel\Secondary\Legacy(
"Legacy panel title", $legacy);
279 $p = $p->withFurtherInformation($secondary);
280 $html = $r->render($p);
282 $expected_html = <<<EOT
283<div
class=
"panel panel-sub panel-flex">
284 <div
class=
"panel-heading ilBlockHeader">
287 <div
class=
"panel-body">
289 <div
class=
"col-sm-8"></div>
290 <div
class=
"col-sm-4">
291 <div
class=
"panel panel-secondary panel-flex">
292 <div
class=
"panel-heading ilHeader">
293 <h2>Legacy panel title</h2>
295 <div
class=
"panel-body">Legacy content</div>
313 $sub = $fp->sub(
"Title", array());
314 $card =
new I\Component\Card\Card(
"Card Title");
315 $sub = $sub->withFurtherInformation($card);
316 $report = $fp->report(
"Title", $sub);
320 $expected_html = <<<EOT
321<div
class=
"panel panel-primary il-panel-report panel-flex">
322 <div
class=
"panel-heading ilHeader">
325 <div
class=
"panel-body">
326 <div
class=
"panel panel-sub panel-flex">
327 <div
class=
"panel-heading ilBlockHeader">
330 <div
class=
"panel-body"><div
class=
"row">
331 <div
class=
"col-sm-8"></div>
332 <div
class=
"col-sm-4">
333 <div
class=
"il-card thumbnail">
334 <div
class=
"card-no-highlight"></div>
335 <div
class=
"caption card-title">Card
Title</div>
354 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options);
356 $p =
$f->standard(
"Title", [])
357 ->withViewControls([$sortation])
360 $this->assertEquals($p->getViewControls(), [$sortation]);
369 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options);
375 $p =
$f->standard(
"Title", [])
376 ->withViewControls([$sortation]);
379 $html = $r->render($p);
381 $expected_html = <<<EOT
382<div
class=
"panel panel-primary panel-flex">
383 <div
class=
"panel-heading ilHeader">
385 <div
class=
"il-viewcontrol-sortation" id=
"id_1">
386<div
class=
"dropdown"><button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" id=
"id_4" aria-label=
"actions" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_4_menu"> <span
class=
"caret"></span></button>
387<ul
id=
"id_4_menu" class=
"dropdown-menu">
388 <li><button
class=
"btn btn-link" data-action=
"?sortation=a" id=
"id_2">
A</button>
390 <li><button
class=
"btn btn-link" data-action=
"?sortation=b" id=
"id_3">
B</button>
396 <div
class=
"panel-body"></div>
404 $pagination = $this->
getUIFactory()->viewControl()->pagination()
405 ->withTargetURL(
'http://ilias.de',
'page')
406 ->withTotalEntries(10)
408 ->withCurrentPage(1);
414 $p =
$f->standard(
"Title", [])
415 ->withViewControls([$pagination]);
417 $html = $r->render($p);
419 $expected_html = <<<EOT
420<div
class=
"panel panel-primary panel-flex">
421 <div
class=
"panel-heading ilHeader">
423 <div
class=
"il-viewcontrol-pagination">
424 <span
class=
"browse previous">
425 <a tabindex=
"0" class=
"glyph" href=
"http://ilias.de?page=0" aria-label=
"back">
426 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
429 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=0" id=
"id_1">1</button>
430 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"http://ilias.de?page=1" id=
"id_2">2</button>
431 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=2" id=
"id_3">3</button>
432 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=3" id=
"id_4">4</button>
433 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=4" id=
"id_5">5</button>
434 <span
class=
"browse next">
435 <a tabindex=
"0" class=
"glyph" href=
"http://ilias.de?page=2" aria-label=
"next">
436 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
441 <div
class=
"panel-body"></div>
getCanonicalName()
Get the canonical name of the component.
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=[])
Test on button implementation.
test_standard_with_actions()
test_render_sub_with_secondary_panel()
test_render_with_pagination()
test_standard_get_content()
test_sub_with_secondary_panel()
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.
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...
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...
Class ChatMainBarProvider \MainMenu\Provider.