3 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
22 require_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)
86 $f = $this->getPanelFactory();
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",
105 $f = $this->getPanelFactory();
108 $this->assertEquals(
"Title", $p->getTitle());
113 $f = $this->getPanelFactory();
115 $p =
$f->standard(
"Title", array(
$c));
117 $this->assertEquals($p->getContent(), array(
$c));
122 $fp = $this->getPanelFactory();
126 $actions =
new I\Component\Dropdown\Standard(array(
131 $p = $p->withActions($actions);
133 $this->assertEquals($p->getActions(), $actions);
138 $fp = $this->getPanelFactory();
142 $actions =
new I\Component\Dropdown\Standard(array(
147 $p = $p->withActions($actions);
149 $this->assertEquals($p->getActions(), $actions);
154 $fp = $this->getPanelFactory();
158 $card =
new I\Component\Card\Card(
"Card Title");
160 $p = $p->withFurtherInformation($card);
162 $this->assertEquals($p->getFurtherInformation(), $card);
167 $fp = $this->getPanelFactory();
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);
181 $f = $this->getPanelFactory();
183 $p =
$f->report(
"Title", array($sub));
185 $this->assertEquals(
"Title", $p->getTitle());
190 $f = $this->getPanelFactory();
192 $p =
$f->report(
"Title", [$sub]);
194 $this->assertEquals($p->getContent(), array($sub));
198 $f = $this->getPanelFactory();
199 $r = $this->getDefaultRenderer();
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>
224 $this->assertHTMLEquals($expected_html, $html);
229 $fp = $this->getPanelFactory();
230 $r = $this->getDefaultRenderer();
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);
241 $html = $this->brutallyTrimHTML($r->render($p));
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>
268 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
273 $fp = $this->getPanelFactory();
274 $r = $this->getDefaultRenderer();
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>
303 $this->assertHTMLEquals(
304 $this->brutallyTrimHTML($expected_html),
305 $this->brutallyTrimHTML($html)
311 $fp = $this->getPanelFactory();
312 $r = $this->getDefaultRenderer();
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);
318 $html = $this->brutallyTrimHTML($r->render($report));
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>
345 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
354 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
355 $f = $this->getPanelFactory();
356 $p =
$f->standard(
"Title", [])
357 ->withViewControls([$sortation])
360 $this->assertEquals($p->getViewControls(), [$sortation]);
369 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
371 $f = $this->getPanelFactory();
372 $r = $this->getDefaultRenderer();
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>
399 $this->assertHTMLEquals($expected_html, $html);
404 $pagination = $this->getUIFactory()->viewControl()->pagination()
405 ->withTargetURL(
'http://ilias.de',
'page')
406 ->withTotalEntries(10)
408 ->withCurrentPage(1);
410 $f = $this->getPanelFactory();
411 $r = $this->getDefaultRenderer();
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>
444 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_implements_factory_interface()
test_standard_get_content()
test_standard_get_title()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Test on button implementation.
Class ChatMainBarProvider .
test_render_with_sortation()
test_standard_with_actions()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_sub_with_secondary_panel()
A component is the most general form of an entity in the UI.
test_with_view_controls()
Provides common functionality for UI tests.
getCanonicalName()
Get the canonical name of the component.
test_report_get_content()
test_render_sub_with_secondary_panel()
test_render_with_pagination()