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;
23 return new \ILIAS\UI\Implementation\Factory(
24 $this->createMock(
C\Counter\Factory::class),
25 $this->createMock(
C\Glyph\Factory::class),
26 $this->createMock(
C\
Button\Factory::class),
27 $this->createMock(
C\Listing\Factory::class),
28 $this->createMock(
C\Image\Factory::class),
29 $this->createMock(
C\Panel\Factory::class),
30 $this->createMock(
C\Modal\Factory::class),
31 $this->createMock(
C\Dropzone\Factory::class),
32 $this->createMock(
C\Popover\Factory::class),
33 $this->createMock(
C\Divider\Factory::class),
34 $this->createMock(
C\Link\Factory::class),
35 $this->createMock(
C\Dropdown\Factory::class),
36 $this->createMock(
C\Item\Factory::class),
37 $this->createMock(
C\Icon\Factory::class),
38 $this->createMock(
C\ViewControl\Factory::class),
39 $this->createMock(
C\Chart\Factory::class),
40 $this->createMock(
C\Input\Factory::class),
41 $this->createMock(
C\Table\Factory::class),
42 $this->createMock(
C\MessageBox\Factory::class),
43 $this->createMock(
C\
Card\Factory::class)
49 return new \ILIAS\UI\Implementation\Component\Card\Factory();
55 $image =
new I\Component\Image\Image(
"standard",
"src",
"alt");
57 return $cf->repositoryObject(
"Card Title", $image);
62 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Card\\RepositoryObject", $this->
getBaseCard());
67 $icon =
new I\Component\Icon\Standard(
"crs",
'Course',
'medium',
false);
69 $card = $card->withObjectIcon($icon);
71 $this->assertEquals($card->getObjectIcon(), $icon);
76 $progressmeter =
new I\Component\Chart\ProgressMeter\Mini(100, 70);
78 $card = $card->withProgress($progressmeter);
80 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Mini", $progressmeter);
81 $this->assertEquals($progressmeter, $card->getProgress());
87 $card_with_cert_true = $card->withCertificateIcon(
true);
88 $card_with_cert_false = $card->withCertificateIcon(
false);
90 $this->assertNull($card->getCertificateIcon());
91 $this->assertTrue($card_with_cert_true->getCertificateIcon());
92 $this->assertFalse($card_with_cert_false->getCertificateIcon());
99 $f->button()->shy(
"Go to Course",
"#"),
100 $f->button()->shy(
"Go to Portfolio",
"#"),
101 $f->divider()->horizontal(),
102 $f->button()->shy(
"ilias.de",
"http://www.ilias.de")
105 $dropdown =
new I\Component\Dropdown\Standard($items);
107 $card = $card->withActions($dropdown);
109 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Dropdown\\Standard", $dropdown);
110 $this->assertEquals($card->getActions(), $dropdown);
117 $icon =
new I\Component\Icon\Standard(
"crs",
'Course',
'medium',
false);
119 $c =
$c->withObjectIcon($icon);
123 $expected_html = <<<EOT
124 <div
class=
"il-card thumbnail">
126 <div
class=
"il-card-repository-head">
128 <div
class=
"icon crs medium" aria-label=
"Course">
137 <div
class=
"il-card-repository-dropdown">
141 <img src=
"src" class=
"img-standard" alt=
"alt" />
142 <div
class=
"card-no-highlight"></div>
143 <div
class=
"caption">
159 $c =
$c->withCertificateIcon(
true);
163 $expected_html = <<<EOT
164 <div
class=
"il-card thumbnail">
166 <div
class=
"il-card-repository-head">
171 <div
class=
"icon cert medium outlined" aria-label=
"Certificate">
177 <div
class=
"il-card-repository-dropdown">
181 <img src=
"src" class=
"img-standard" alt=
"alt" />
182 <div
class=
"card-no-highlight"></div>
183 <div
class=
"caption">
197 $prg =
new I\Component\Chart\ProgressMeter\Mini(100, 80);
198 $c =
$c->withProgress($prg);
202 $expected_html = <<<EOT
203 <div
class=
"il-card thumbnail">
205 <div
class=
"il-card-repository-head">
210 <div
class=
"il-chart-progressmeter-box il-chart-progressmeter-mini">
211 <div
class=
"il-chart-progressmeter-container">
212 <svg viewBox=
"0 0 50 40" class=
"il-chart-progressmeter-viewbox">
213 <path
class=
"il-chart-progressmeter-circle-bg" stroke-dasharray=
"100, 100" 214 d=
"M9,35 q-4.3934,-4.3934 -4.3934,-10.6066 a1,1 0 1,1 40,0 q0,6.2132 -4.3934,10.6066"></path>
215 <path
class=
"il-chart-progressmeter-circle no-success" stroke-dasharray=
"69.2, 100" 216 d=
"M9,35 q-4.3934,-4.3934 -4.3934,-10.6066 a1,1 0 1,1 40,0 q0,6.2132 -4.3934,10.6066"></path>
217 <path
class=
"il-chart-progressmeter-needle no-needle" stroke-dasharray=
"100, 100" 218 d=
"M25,10 l0,15" style=
"transform: rotate(deg)"></path>
223 <div
class=
"il-card-repository-dropdown">
227 <img src=
"src" class=
"img-standard" alt=
"alt" />
228 <div
class=
"card-no-highlight"></div>
229 <div
class=
"caption">
247 $dropdown =
new I\Component\Dropdown\Standard($items);
248 $c =
$c->withActions($dropdown);
251 $expected_html = <<<EOT
252 <div
class=
"il-card thumbnail">
254 <div
class=
"il-card-repository-head">
261 <div
class=
"il-card-repository-dropdown">
262 <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>
263 <ul
class=
"dropdown-menu">
264 <li><button
class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1" >Visit
ILIAS</button>
271 <img src=
"src" class=
"img-standard" alt=
"alt" />
272 <div
class=
"card-no-highlight"></div>
273 <div
class=
"caption">
test_render_with_certificate_icon()
TODO change the custom icons to standard icons Test on Repository Object card implementation.
test_implements_factory_interface()
getDefaultRenderer(JavaScriptBinding $js_binding=null)
test_render_with_object_icon()
test_render_with_progressmeter()
test_render_with_actions()
Provides common functionality for UI tests.
test_with_certificate_icon()
assertHTMLEquals($expected_html_as_string, $html_as_string)