19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/TableTestBase.php");
35 return new I\Component\Table\Factory(
48 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Table\\Factory",
$f);
50 $pt =
$f->presentation(
'title', [],
function ():
void {
52 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Table\\Presentation", $pt);
54 $this->assertEquals(
"title", $pt->getTitle());
55 $this->assertEquals([], $pt->getViewControls());
56 $this->assertInstanceOf(Closure::class, $pt->getRowMapping());
59 ->withEnvironment(array(
'k' =>
'v'))
60 ->withData(array(
'dk' =>
'dv'));
61 $this->assertEquals(array(
'k' =>
'v'), $pt->getEnvironment());
62 $this->assertEquals(array(
'dk' =>
'dv'), $pt->getData());
68 $pt =
$f->presentation(
'title', [],
function ():
void {
72 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Table\\PresentationRow", $row);
73 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $row->getShowSignal());
74 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $row->getCloseSignal());
75 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $row->getToggleSignal());
79 $row->withHeadline(
"headline")->getHeadline()
83 $row->withSubheadline(
"subheadline")->getSubheadline()
87 $row->withImportantFields(array(
"f1" =>
"v1"))->getImportantFields()
91 $row->withFurtherFieldsHeadline(
"field_headline")->getFurtherFieldsHeadline()
94 array(
"ff1" =>
"fv1"),
95 $row->withFurtherFields(array(
"ff1" =>
"fv1"))->getFurtherFields()
102 public I\Component\SignalGenerator $sig_gen;
104 public function button(): C\Button\Factory
106 return new I\Component\Button\Factory(
112 return new I\Component\Symbol\Factory(
119 $factory->sig_gen =
new I\Component\SignalGenerator();
126 'headline' =>
'some title',
127 'subhead' =>
'some type',
128 'important_fields' => [
'important-1',
'important-2'],
129 'content' => [
'1st' =>
'first content',
'2nd' =>
'second content'],
130 'further_headline' =>
'further fields',
131 'further_fields' => [
'f-1' =>
'further',
'f-2' =>
'way further'],
138 $mapping =
function ($row, $record, $ui_factory, $environment) {
140 ->withHeadline($record[
'headline'])
141 ->withSubheadline($record[
'subhead'])
142 ->withImportantFields($record[
'important_fields'])
143 ->withContent((
new I\
Component\Listing\Descriptive($record[
'content'])))
144 ->withFurtherFieldsHeadline($record[
'further_headline'])
145 ->withFurtherFields($record[
'further_fields'])
150 <div
class=
"il-table-presentation" id=
"id_3">
151 <h3
class=
"ilHeader">title</h3>
152 <div
class=
"il-table-presentation-viewcontrols">
153 <div
class=
"l-bar__space-keeper l-bar__space-keeper--space-between">
154 <div
class=
"l-bar__group">
155 <div
class=
"l-bar__element">
156 <
button class=
"btn btn-default" id=
"id_1">presentation_table_expand</
button>
157 <
button class=
"btn btn-default" id=
"id_2">presentation_table_collapse</button>
160 <div
class=
"l-bar__group"></div>
163 <div
class=
"il-table-presentation-data">
164 <div
class=
"il-table-presentation-row row collapsed" id=
"id_4">
166 <div
class=
"il-table-presentation-row-controls col-lg-auto col-sm-12">
167 <div
class=
"il-table-presentation-row-controls-expander inline">
168 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"expand_content" id=
"id_5">
169 <span
class=
"glyphicon glyphicon-triangle-right" aria-hidden=
"true"></span>
172 <div
class=
"il-table-presentation-row-controls-collapser">
173 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"collapse_content" id=
"id_6">
174 <span
class=
"glyphicon glyphicon-triangle-bottom" aria-hidden=
"true"></span>
179 <div
class=
"il-table-presentation-row-contents col-lg col-sm-12">
181 <div
class=
"il-table-presentation-row-header col-lg col-sm-12">
182 <h4
class=
"il-table-presentation-row-header-headline" onClick=
"$(document).trigger('il_signal...');">some title<br /><
small>some type</
small>
184 <div
class=
"il-table-presentation-row-header-fields">
185 <div
class=
"l-bar__space-keeper">
186 <div
class=
"l-bar__group">
187 <div
class=
"il-table-presentation-row-header-fields-value l-bar__element">important-1</div>
190 <div
class=
"l-bar__space-keeper">
191 <div
class=
"l-bar__group">
192 <div
class=
"il-table-presentation-row-header-fields-value l-bar__element">important-2</div>
195 <button
class=
"btn btn-link" id=
"id_7">presentation_table_more</button>
198 <div
class=
"il-table-presentation-actions col-lg-auto col-sm-12">
199 <button
class=
"btn btn-default" data-action=
"#" id=
"id_8">
do</button><br />
201 <div
class=
"il-table-presentation-row-expanded col-lg-12 col-sm-12">
203 <div
class=
"il-table-presentation-desclist col-lg col-sm-12 desclist-column">
206 <dd>first content</dd>
208 <dd>second content</dd>
211 <div
class=
"il-table-presentation-details col-lg-5 col-sm-12">
212 <div
class=
"il-table-presentation-fields">
213 <h5>further fields</h5>
214 <span
class=
"il-item-property-name">f-1</span>
215 <span
class=
"il-item-property-value">further</span>
217 <span
class=
"il-item-property-name">f-2</span>
218 <span
class=
"il-item-property-value">way further</span>
231 $r = $this->getDefaultRenderer();
233 $pt =
$f->presentation(
'title', [], $mapping);
234 $actual =
$r->render($pt->withData($this->getDummyData()));
236 $this->brutallyTrimHTML($expected),
237 $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
244 $mapping =
function ($row, $record, $ui_factory, $environment) {
246 ->withHeadline($record[
'headline'])
247 ->withContent((
new I\
Component\Listing\Descriptive($record[
'content'])));
251 <div
class=
"il-table-presentation" id=
"id_3">
252 <h3
class=
"ilHeader">title</h3>
253 <div
class=
"il-table-presentation-viewcontrols">
255 <div
class=
"l-bar__space-keeper l-bar__space-keeper--space-between">
256 <div
class=
"l-bar__group">
257 <div
class=
"l-bar__element">
259 <
button class=
"btn btn-default" id=
"id_1">presentation_table_expand</
button>
260 <
button class=
"btn btn-default" id=
"id_2">presentation_table_collapse</button>
263 <div
class=
"l-bar__group"></div>
266 <div
class=
"il-table-presentation-data">
267 <div
class=
"il-table-presentation-row row collapsed" id=
"id_4">
269 <div
class=
"il-table-presentation-row-controls col-lg-auto col-sm-12">
270 <div
class=
"il-table-presentation-row-controls-expander inline">
271 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"expand_content" id=
"id_5">
272 <span
class=
"glyphicon glyphicon-triangle-right" aria-hidden=
"true"></span>
275 <div
class=
"il-table-presentation-row-controls-collapser">
276 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"collapse_content" id=
"id_6">
277 <span
class=
"glyphicon glyphicon-triangle-bottom" aria-hidden=
"true"></span>
282 <div
class=
"il-table-presentation-row-contents col-lg col-sm-12">
284 <div
class=
"il-table-presentation-row-header col-lg col-sm-12">
285 <h4
class=
"il-table-presentation-row-header-headline" onClick=
"$(document).trigger('il_signal...');">some title</h4>
286 <div
class=
"il-table-presentation-row-header-fields">
287 <button
class=
"btn btn-link" id=
"id_7">presentation_table_more</button>
290 <div
class=
"il-table-presentation-actions col-lg-auto col-sm-12"></div>
291 <div
class=
"il-table-presentation-row-expanded col-lg-12 col-sm-12">
293 <div
class=
"il-table-presentation-desclist col-lg col-sm-12">
296 <dd>first content</dd>
298 <dd>second content</dd>
310 $r = $this->getDefaultRenderer();
312 $pt =
$f->presentation(
'title', [], $mapping);
313 $actual =
$r->render($pt->withData($this->getDummyData()));
315 $this->brutallyTrimHTML($expected),
316 $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
322 $mapping = fn(
PresentationRow $row, mixed $record, \
ILIAS\
UI\Factory $ui_factory, mixed $environment) => $row;
326 $html = $this->getDefaultRenderer()->render($table);
328 $translation = $this->
getLanguage()->txt(
'ui_table_no_records');
330 $this->assertTrue(str_contains($html, $translation));
Tests for Presentation Table.
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
small()
description: > This can be used, when space is very scarce and the label cannot be displayed ...
Basic Tests for all Tables.
testRenderEmptyTableEntry()