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;
19 return "Component Dummy";
34 return new I\Component\Panel\Factory(
35 $this->createMock(
C\Panel\Listing\Factory::class)
41 $f = $this->getPanelFactory();
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",
60 $f = $this->getPanelFactory();
63 $this->assertEquals($p->getTitle(),
"Title");
68 $f = $this->getPanelFactory();
70 $p =
$f->standard(
"Title", array(
$c));
72 $this->assertEquals($p->getContent(), array(
$c));
77 $fp = $this->getPanelFactory();
81 $actions =
new I\Component\Dropdown\Standard(array(
86 $p = $p->withActions($actions);
88 $this->assertEquals($p->getActions(), $actions);
93 $fp = $this->getPanelFactory();
97 $actions =
new I\Component\Dropdown\Standard(array(
102 $p = $p->withActions($actions);
104 $this->assertEquals($p->getActions(), $actions);
109 $fp = $this->getPanelFactory();
113 $card =
new I\Component\Card\Card(
"Card Title");
115 $p = $p->withCard($card);
117 $this->assertEquals($p->getCard(), $card);
122 $f = $this->getPanelFactory();
124 $p =
$f->report(
"Title", array($sub));
126 $this->assertEquals($p->getTitle(),
"Title");
131 $f = $this->getPanelFactory();
133 $p =
$f->report(
"Title", $sub);
135 $this->assertEquals($p->getContent(), array($sub));
141 $f = $this->getPanelFactory();
142 $r = $this->getDefaultRenderer();
144 $actions =
new I\Component\Dropdown\Standard(array(
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>
167 $this->assertHTMLEquals($expected_html,
$html);
172 $fp = $this->getPanelFactory();
173 $r = $this->getDefaultRenderer();
175 $actions =
new I\Component\Dropdown\Standard(array(
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">
212 $this->assertHTMLEquals($expected_html,
$html);
216 $fp = $this->getPanelFactory();
217 $r = $this->getDefaultRenderer();
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>" .
246 $this->assertHTMLEquals($expected_html,
$html);
test_implements_factory_interface()
test_standard_get_content()
test_standard_get_title()
Test on button implementation.
test_standard_with_actions()
if(!array_key_exists('StateId', $_REQUEST)) $id
A component is the most general form of an entity in the UI.
Provides common functionality for UI tests.
getCanonicalName()
Get the canonical name of the component.
test_report_get_content()