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);
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">
232 <div
class=
"card-title">Card
Title</div>
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">
271 <div
class=
"card-title">Card
Title</div>
291 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options);
293 $p =
$f->standard(
"Title", [])
294 ->withViewControls([$sortation]);
297 $this->assertEquals($p->getViewControls(), [$sortation]);
306 $sortation = $this->
getUIFactory()->viewControl()->sortation($sort_options);
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>
341 $pagination = $this->
getUIFactory()->viewControl()->pagination()
342 ->withTargetURL(
'http://ilias.de',
'page')
343 ->withTotalEntries(10)
345 ->withCurrentPage(1);
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>
disabled()
Example showing how to plug a disabled checkbox into a form.
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)
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.