19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
40 'divider' => $this->createMock(
I\
Component\Divider\Factory::class),
44 protected array $mocks
47 public function legacy(): I\Component\Legacy\Factory
49 return new I\Component\Legacy\Factory(
new I\
Component\SignalGenerator());
51 public function button(): I\Component\Button\Factory
53 return $this->mocks[
'button'];
55 public function divider(): I\Component\Divider\Factory
57 return $this->mocks[
'divider'];
59 public function symbol(): I\Component\Symbol\Factory
61 return new I\Component\Symbol\Factory(
79 $image =
new I\Component\Image\Image(
"standard",
"src",
"alt");
81 return $cf->repositoryObject(
"Card Title", $image);
86 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Card\\RepositoryObject", $this->
getBaseCard());
91 $button_factory =
new I\Component\Button\Factory();
92 $button = $button_factory->shy(
"Card Title New",
"");
95 $image =
new I\Component\Image\Image(
"standard",
"src",
"alt");
97 $this->assertEquals($button, $cf->repositoryObject($button, $image)->getTitle());
102 $icon =
new I\Component\Symbol\Icon\Standard(
"crs",
'Course',
'medium',
false);
104 $card = $card->withObjectIcon($icon);
106 $this->assertEquals($card->getObjectIcon(), $icon);
111 $progressmeter =
new I\Component\Chart\ProgressMeter\Mini(100, 70);
113 $card = $card->withProgress($progressmeter);
115 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Mini", $progressmeter);
116 $this->assertEquals($progressmeter, $card->getProgress());
122 $card_with_cert_true = $card->withCertificateIcon(
true);
123 $card_with_cert_false = $card->withCertificateIcon(
false);
125 $this->assertNull($card->getCertificateIcon());
126 $this->assertTrue($card_with_cert_true->getCertificateIcon());
127 $this->assertFalse($card_with_cert_false->getCertificateIcon());
134 $f->button()->shy(
"Go to Course",
"#"),
135 $f->button()->shy(
"Go to Portfolio",
"#"),
136 $f->divider()->horizontal(),
137 $f->button()->shy(
"ilias.de",
"http://www.ilias.de")
140 $dropdown =
new I\Component\Dropdown\Standard($items);
142 $card = $card->withActions($dropdown);
144 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Dropdown\\Standard", $dropdown);
145 $this->assertEquals($card->getActions(), $dropdown);
151 $button_factory =
new I\Component\Button\Factory();
152 $button = $button_factory->shy(
"Card Title New",
"");
154 $c =
$c->withTitle($button);
155 $this->assertEquals($button,
$c->getTitle());
160 $r = $this->getDefaultRenderer();
162 $icon =
new I\Component\Symbol\Icon\Standard(
"crs",
'Course',
'medium',
false);
164 $c =
$c->withObjectIcon($icon);
166 $html = $this->brutallyTrimHTML(
$r->render(
$c));
168 $expected_html = $this->brutallyTrimHTML(<<<EOT
169 <div
class=
"il-card thumbnail">
170 <div
class=
"il-card-repository-head">
172 <img
class=
"icon crs medium" src=
"./assets/images/standard/icon_crs.svg" alt=
"Course" />
177 <div
class=
"il-card-repository-dropdown">
181 <div
class=
"il-card-image-container"><img src=
"src" class=
"img-standard" alt=
"open Card Title" /></div>
182 <div
class=
"card-no-highlight"></div>
187 $this->assertHTMLEquals($expected_html, $html);
192 $r = $this->getDefaultRenderer();
196 $c =
$c->withCertificateIcon(
true);
198 $html = $this->brutallyTrimHTML(
$r->render(
$c));
200 $expected_html = $this->brutallyTrimHTML(<<<EOT
201 <div
class=
"il-card thumbnail">
203 <div
class=
"il-card-repository-head">
208 <img
class=
"icon cert medium" src=
"./assets/images/standard/icon_cert.svg" alt=
"Certificate" />
210 <div
class=
"il-card-repository-dropdown">
214 <div
class=
"il-card-image-container"><img src=
"src" class=
"img-standard" alt=
"open Card Title" /></div>
215 <div
class=
"card-no-highlight"></div>
220 $this->assertHTMLEquals($expected_html, $html);
225 $r = $this->getDefaultRenderer();
227 $prg =
new I\Component\Chart\ProgressMeter\Mini(100, 80);
228 $c =
$c->withProgress($prg);
230 $html = $this->brutallyTrimHTML(
$r->render(
$c));
232 $expected_html = $this->brutallyTrimHTML(
' 233 <div class="il-card thumbnail"> 234 <div class="il-card-repository-head"> 237 <div class="il-chart-progressmeter-box il-chart-progressmeter-mini"> 238 <div class="il-chart-progressmeter-container"> 239 <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox"> 240 <path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" 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> 241 <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="69.2, 100" 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> 242 <path class="il-chart-progressmeter-needle no-needle" stroke-dasharray="100, 100" d="M25,10 l0,15" style="transform: rotate(deg)"></path> 247 <div class="il-card-repository-dropdown"></div> 249 <div class="il-card-image-container"><img src="src" class="img-standard" alt="open Card Title"/></div> 250 <div class="card-no-highlight"></div> 251 <div class="caption card-title">Card Title</div> 254 $this->assertHTMLEquals($expected_html, $html);
259 $r = $this->getDefaultRenderer();
264 $dropdown =
new I\Component\Dropdown\Standard($items);
265 $c =
$c->withActions($dropdown);
266 $html = $this->brutallyTrimHTML(
$r->render(
$c));
268 $expected_html = $this->brutallyTrimHTML(
' 269 <div class="il-card thumbnail"> 270 <div class="il-card-repository-head"> 273 <div class="il-card-repository-dropdown"> 274 <div class="dropdown" id="id_3"> 275 <button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"><span class="caret"></span></button> 276 <ul id="id_3_menu" class="dropdown-menu"> 277 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_2">Visit ILIAS</button></li> 282 <div class="il-card-image-container"><img src="src" class="img-standard" alt="open Card Title" /></div> 283 <div class="card-no-highlight"></div> 284 <div class="caption card-title">Card Title</div> 288 $this->assertHTMLEquals($expected_html, $html);
button(string $caption, string $cmd)
Test on Repository Object card implementation.
testImplementsFactoryInterface()
testRenderWithCertificateIcon()
testWithCertificateIcon()
testFactoryWithShyButton()
legacy()
expected output: > ILIAS shows the rendered Component.
testRenderWithObjectIcon()
__construct(Container $dic, ilPlugin $plugin)
testRenderWithProgressmeter()