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;
19 return "Component Dummy";
34 return new I\Component\Panel\Factory(
35 $this->createMock(
C\Panel\Listing\Factory::class)
43 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Panel\\Factory",
$f);
44 $this->assertInstanceOf(
45 "ILIAS\\UI\\Component\\Panel\\Standard",
48 $this->assertInstanceOf(
49 "ILIAS\\UI\\Component\\Panel\\Sub",
52 $this->assertInstanceOf(
53 "ILIAS\\UI\\Component\\Panel\\Report",
63 $this->assertEquals($p->getTitle(),
"Title");
70 $p =
$f->standard(
"Title", array(
$c));
72 $this->assertEquals($p->getContent(), array(
$c));
81 $actions =
new I\Component\Dropdown\Standard(array(
82 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
83 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
86 $p = $p->withActions($actions);
88 $this->assertEquals($p->getActions(), $actions);
97 $actions =
new I\Component\Dropdown\Standard(array(
98 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
99 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
102 $p = $p->withActions($actions);
104 $this->assertEquals($p->getActions(), $actions);
113 $card =
new I\Component\Card\Card(
"Card Title");
115 $p = $p->withCard($card);
117 $this->assertEquals($p->getCard(), $card);
124 $p =
$f->report(
"Title", array($sub));
126 $this->assertEquals($p->getTitle(),
"Title");
133 $p =
$f->report(
"Title", $sub);
135 $this->assertEquals($p->getContent(), array($sub));
144 $actions =
new I\Component\Dropdown\Standard(array(
145 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
146 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
149 $p =
$f->standard(
"Title", array())->withActions($actions);
153 $expected_html = <<<EOT
154<div
class=
"panel panel-primary">
155 <div
class=
"panel-heading ilHeader clearfix">
156 <h3
class=
"ilHeader">
Title</h3>
157 <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>
158 <ul
class=
"dropdown-menu">
159 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
160 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
164 <div
class=
"panel-body"></div>
175 $actions =
new I\Component\Dropdown\Standard(array(
176 new I\Component\
Button\Shy(
"ILIAS",
"https://www.ilias.de"),
177 new I\Component\
Button\Shy(
"GitHub",
"https://www.github.com")
180 $p = $fp->sub(
"Title", array())->withActions($actions);
181 $card =
new I\Component\Card\Card(
"Card Title");
182 $p = $p->withCard($card);
185 $expected_html = <<<EOT
186<div
class=
"panel panel-primary">
187 <div
class=
"panel-heading ilBlockHeader clearfix">
189 <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>
190 <ul
class=
"dropdown-menu">
191 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
192 <li><button
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
196 <div
class=
"panel-body">
198 <div
class=
"col-sm-8"></div>
199 <div
class=
"col-sm-4">
200 <div
class=
"il-card thumbnail">
201 <div
class=
"card-no-highlight"></div>
202 <div
class=
"caption">
203 <h5
class=
"card-title">Card
Title</h5>
218 $sub = $fp->sub(
"Title", array());
219 $card =
new I\Component\Card\Card(
"Card Title");
220 $sub = $sub->withCard($card);
221 $report = $fp->report(
"Title", $sub);
226 "<div class=\"panel panel-primary il-panel-report\">" .
227 " <div class=\"panel-heading ilHeader\">" .
228 "<h3 class=\"ilHeader\">Title</h3>" .
230 " <div class=\"panel-body\">" .
232 <div class=\"panel panel-primary\">" .
233 " <div class=\"panel-heading ilBlockHeader clearfix\">" .
236 " <div class=\"panel-body\"><div class=\"row\">" .
237 " <div class=\"col-sm-8\"></div>" .
238 " <div class=\"col-sm-4\">" .
239 " <div class=\"il-card thumbnail\"><div class=\"card-no-highlight\"></div><div class=\"caption\"><h5 class=\"card-title\">Card Title</h5></div></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)
Test on button implementation.
test_standard_with_actions()
test_standard_get_content()
test_report_get_content()
test_standard_get_title()
test_implements_factory_interface()
if(!array_key_exists('StateId', $_REQUEST)) $id
A component is the most general form of an entity in the UI.