19 declare(strict_types=1);
21 require_once(
"libs/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/TableTestBase.php");
36 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Table\\Factory",
$f);
38 $pt =
$f->presentation(
'title', [],
function ():
void {
40 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Table\\Presentation", $pt);
42 $this->assertEquals(
"title", $pt->getTitle());
43 $this->assertEquals([], $pt->getViewControls());
44 $this->assertInstanceOf(Closure::class, $pt->getRowMapping());
47 ->withEnvironment(array(
'k' =>
'v'))
48 ->withData(array(
'dk' =>
'dv'));
49 $this->assertEquals(array(
'k' =>
'v'), $pt->getEnvironment());
50 $this->assertEquals(array(
'dk' =>
'dv'), $pt->getData());
57 $pt =
$f->presentation(
'title', [],
function ():
void {
60 <div
class=
"il-table-presentation" id=
"id_1">
61 <h3
class=
"ilHeader">title</h3>
62 <div
class=
"il-table-presentation-data"></div>
75 $pt =
$f->presentation(
'title', [],
function ():
void {
79 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Table\\PresentationRow", $row);
80 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $row->getShowSignal());
81 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $row->getCloseSignal());
82 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $row->getToggleSignal());
86 $row->withHeadline(
"headline")->getHeadline()
90 $row->withSubheadline(
"subheadline")->getSubheadline()
94 $row->withImportantFields(array(
"f1" =>
"v1"))->getImportantFields()
98 $row->withFurtherFieldsHeadline(
"field_headline")->getFurtherFieldsHeadline()
101 array(
"ff1" =>
"fv1"),
102 $row->withFurtherFields(array(
"ff1" =>
"fv1"))->getFurtherFields()
109 public I\Component\SignalGenerator $sig_gen;
111 public function button(): C\Button\Factory
113 return new I\Component\Button\Factory(
119 return new I\Component\Symbol\Factory(
126 $factory->sig_gen =
new I\Component\SignalGenerator();
133 'headline' =>
'some title',
134 'subhead' =>
'some type',
135 'important_fields' => [
'important-1',
'important-2'],
136 'content' => [
'1st' =>
'first content',
'2nd' =>
'second content'],
137 'further_headline' =>
'further fields',
138 'further_fields' => [
'f-1' =>
'further',
'f-2' =>
'way further'],
145 $mapping =
function ($row, $record, $ui_factory, $environment) {
147 ->withHeadline($record[
'headline'])
148 ->withSubheadline($record[
'subhead'])
149 ->withImportantFields($record[
'important_fields'])
150 ->withContent((
new I\
Component\Listing\Descriptive($record[
'content'])))
151 ->withFurtherFieldsHeadline($record[
'further_headline'])
152 ->withFurtherFields($record[
'further_fields'])
157 <div
class=
"il-table-presentation" id=
"id_1">
158 <h3
class=
"ilHeader">title</h3>
159 <div
class=
"il-table-presentation-data">
160 <div
class=
"il-table-presentation-row row collapsed" id=
"id_2">
162 <div
class=
"il-table-presentation-row-controls">
163 <div
class=
"il-table-presentation-row-controls-expander inline">
164 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"expand_content" id=
"id_3">
165 <span
class=
"glyphicon glyphicon-triangle-right" aria-hidden=
"true"></span>
168 <div
class=
"il-table-presentation-row-controls-collapser">
169 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"collapse_content" id=
"id_4">
170 <span
class=
"glyphicon glyphicon-triangle-bottom" aria-hidden=
"true"></span>
175 <div
class=
"il-table-presentation-row-contents">
176 <div
class=
"il-table-presentation-actions"><button
class=
"btn btn-default" data-action=
"#" id=
"id_6">
do</button><br /></div>
177 <div
class=
"il-table-presentation-row-header">
178 <h4
class=
"il-table-presentation-row-header-headline" onClick=
"$(document).trigger('il_signal...');">some title<br /><
small>some type</
small>
180 <div
class=
"il-table-presentation-row-header-fields">important-1|important-2|<button
class=
"btn btn-link" id=
"id_5">presentation_table_more</button></div>
183 <div
class=
"il-table-presentation-row-expanded">
184 <div
class=
"il-table-presentation-desclist inline desclist-column">
187 <dd>first content</dd>
189 <dd>second content</dd>
193 <div
class=
"il-table-presentation-details inline">
194 <div
class=
"il-table-presentation-fields">
196 <span
class=
"il-item-property-name">f-1</span>
197 <span
class=
"il-item-property-value">further</span>
199 <span
class=
"il-item-property-name">f-2</span>
200 <span
class=
"il-item-property-value">way further</span>
214 $pt =
$f->presentation(
'title', [], $mapping);
215 $actual = $r->render($pt->withData($this->getDummyData()));
225 $mapping =
function ($row, $record, $ui_factory, $environment) {
227 ->withHeadline($record[
'headline'])
228 ->withContent((
new I\
Component\Listing\Descriptive($record[
'content'])));
232 <div
class=
"il-table-presentation" id=
"id_1">
233 <h3
class=
"ilHeader">title</h3>
234 <div
class=
"il-table-presentation-data">
235 <div
class=
"il-table-presentation-row row collapsed" id=
"id_2">
237 <div
class=
"il-table-presentation-row-controls">
238 <div
class=
"il-table-presentation-row-controls-expander inline">
239 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"expand_content" id=
"id_3">
240 <span
class=
"glyphicon glyphicon-triangle-right" aria-hidden=
"true"></span>
243 <div
class=
"il-table-presentation-row-controls-collapser">
244 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"collapse_content" id=
"id_4">
245 <span
class=
"glyphicon glyphicon-triangle-bottom" aria-hidden=
"true"></span>
250 <div
class=
"il-table-presentation-row-contents">
251 <div
class=
"il-table-presentation-actions"></div>
252 <div
class=
"il-table-presentation-row-header">
253 <h4
class=
"il-table-presentation-row-header-headline" onClick=
"$(document).trigger('il_signal...');">some title</h4>
254 <div
class=
"il-table-presentation-row-header-fields">
255 <button
class=
"btn btn-link" id=
"id_5">presentation_table_more</button>
258 <div
class=
"il-table-presentation-row-expanded">
259 <div
class=
"il-table-presentation-desclist inline">
262 <dd>first content</dd>
264 <dd>second content</dd>
276 $pt =
$f->presentation(
'title', [], $mapping);
277 $actual = $r->render($pt->withData($this->getDummyData()));
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Tests for Presentation Table.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
brutallyTrimSignals(string $html)
A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output...
Basic Tests for all Tables.