5 require_once(__DIR__ .
"/../../../../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\SignalGenerator;
20 return "Component Dummy";
31 $factory =
new class extends NoUIFactory {
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(
65 return new I\Component\Panel\Factory(
66 $this->createMock(
C\Panel\Listing\Factory::class)
72 $f = $this->getPanelFactory();
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",
91 $f = $this->getPanelFactory();
94 $this->assertEquals($p->getTitle(),
"Title");
99 $f = $this->getPanelFactory();
101 $p =
$f->standard(
"Title", array(
$c));
103 $this->assertEquals($p->getContent(), array(
$c));
108 $fp = $this->getPanelFactory();
112 $actions =
new I\Component\Dropdown\Standard(array(
117 $p = $p->withActions($actions);
119 $this->assertEquals($p->getActions(), $actions);
124 $fp = $this->getPanelFactory();
128 $actions =
new I\Component\Dropdown\Standard(array(
133 $p = $p->withActions($actions);
135 $this->assertEquals($p->getActions(), $actions);
140 $fp = $this->getPanelFactory();
144 $card =
new I\Component\Card\Card(
"Card Title");
146 $p = $p->withCard($card);
148 $this->assertEquals($p->getCard(), $card);
153 $f = $this->getPanelFactory();
155 $p =
$f->report(
"Title", array($sub));
157 $this->assertEquals($p->getTitle(),
"Title");
162 $f = $this->getPanelFactory();
164 $p =
$f->report(
"Title", $sub);
166 $this->assertEquals($p->getContent(), array($sub));
170 $f = $this->getPanelFactory();
171 $r = $this->getDefaultRenderer();
173 $actions =
new I\Component\Dropdown\Standard(array(
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>
196 $this->assertHTMLEquals($expected_html, $html);
201 $fp = $this->getPanelFactory();
202 $r = $this->getDefaultRenderer();
204 $actions =
new I\Component\Dropdown\Standard(array(
209 $p = $fp->sub(
"Title", array())->withActions($actions);
210 $card =
new I\Component\Card\Card(
"Card Title");
211 $p = $p->withCard($card);
212 $html = $r->render($p);
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">
241 $this->assertHTMLEquals($expected_html, $html);
246 $fp = $this->getPanelFactory();
247 $r = $this->getDefaultRenderer();
248 $sub = $fp->sub(
"Title", array());
249 $card =
new I\Component\Card\Card(
"Card Title");
250 $sub = $sub->withCard($card);
251 $report = $fp->report(
"Title", $sub);
253 $html = $r->render($report);
255 $expected_html = <<<EOT
256 <div
class=
"panel panel-primary il-panel-report panel-flex">
257 <div
class=
"panel-heading ilHeader">
260 <div
class=
"panel-body">
261 <div
class=
"panel panel-sub panel-flex">
262 <div
class=
"panel-heading ilBlockHeader">
265 <div
class=
"panel-body"><div
class=
"row">
266 <div
class=
"col-sm-8"></div>
267 <div
class=
"col-sm-4">
268 <div
class=
"il-card thumbnail">
269 <div
class=
"card-no-highlight"></div>
270 <div
class=
"caption">
282 $this->assertHTMLEquals($expected_html, $html);
291 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
292 $f = $this->getPanelFactory();
293 $p =
$f->standard(
"Title", [])
294 ->withViewControls([$sortation]);
297 $this->assertEquals($p->getViewControls(), [$sortation]);
306 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
308 $f = $this->getPanelFactory();
309 $r = $this->getDefaultRenderer();
312 $p =
$f->standard(
"Title", [])
313 ->withViewControls([$sortation]);
316 $html = $r->render($p);
318 $expected_html = <<<EOT
319 <div
class=
"panel panel-primary panel-flex">
320 <div
class=
"panel-heading ilHeader">
322 <div
class=
"il-viewcontrol-sortation" id=
"">
323 <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>
324 <ul
class=
"dropdown-menu">
325 <li><button
class=
"btn btn-link" data-action=
"?sortation=a" id=
"id_1">
A</button>
327 <li><button
class=
"btn btn-link" data-action=
"?sortation=b" id=
"id_2">
B</button>
333 <div
class=
"panel-body"></div>
336 $this->assertHTMLEquals($expected_html, $html);
341 $pagination = $this->getUIFactory()->viewControl()->pagination()
342 ->withTargetURL(
'http://ilias.de',
'page')
343 ->withTotalEntries(10)
345 ->withCurrentPage(1);
347 $f = $this->getPanelFactory();
348 $r = $this->getDefaultRenderer();
351 $p =
$f->standard(
"Title", [])
352 ->withViewControls([$pagination]);
354 $html = $r->render($p);
356 $expected_html = <<<EOT
357 <div
class=
"panel panel-primary panel-flex">
358 <div
class=
"panel-heading ilHeader">
360 <div
class=
"il-viewcontrol-pagination">
361 <span
class=
"browse previous"><a
class=
"glyph" href=
"http://ilias.de?page=0" aria-label=
"back">
362 <span
class=
"glyphicon 363 glyphicon-chevron-left 364 " aria-hidden=
"true"></span>
367 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=0" id=
"id_1">1</button>
368 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=1" disabled=
"disabled">2</button>
369 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=2" id=
"id_2">3</button>
370 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=3" id=
"id_3">4</button>
371 <button
class=
"btn btn-link" data-action=
"http://ilias.de?page=4" id=
"id_4">5</button>
372 <span
class=
"browse next"><a
class=
"glyph" href=
"http://ilias.de?page=2" aria-label=
"next">
373 <span
class=
"glyphicon 374 glyphicon-chevron-right 375 " aria-hidden=
"true"></span>
381 <div
class=
"panel-body"></div>
384 $this->assertHTMLEquals($expected_html, $html);
test_implements_factory_interface()
test_standard_get_content()
test_standard_get_title()
Test on button implementation.
Class ChatMainBarProvider .
test_render_with_sortation()
test_standard_with_actions()
A component is the most general form of an entity in the UI.
test_with_view_controls()
Provides common functionality for UI tests.
disabled()
Example showing how to plug a disabled checkbox into a form.
getCanonicalName()
Get the canonical name of the component.
test_report_get_content()
test_render_with_pagination()