Tests for Presentation Table.
More...
Tests for Presentation Table.
Definition at line 31 of file PresentationTest.php.
◆ getDummyData()
PresentationTest::getDummyData |
( |
| ) |
|
|
protected |
Definition at line 121 of file PresentationTest.php.
124 'headline' =>
'some title',
125 'subhead' =>
'some type',
126 'important_fields' => [
'important-1',
'important-2'],
127 'content' => [
'1st' =>
'first content',
'2nd' =>
'second content'],
128 'further_headline' =>
'further fields',
129 'further_fields' => [
'f-1' =>
'further',
'f-2' =>
'way further'],
◆ getFactory()
PresentationTest::getFactory |
( |
| ) |
|
|
private |
Definition at line 33 of file PresentationTest.php.
33 : I\Component\Table\Factory
35 return new I\Component\Table\Factory(
Interface Observer Contains several chained tasks and infos about them.
◆ getUIFactory()
PresentationTest::getUIFactory |
( |
| ) |
|
◆ testFullRendering()
PresentationTest::testFullRendering |
( |
| ) |
|
Definition at line 134 of file PresentationTest.php.
References Vendor\Package\$f, $r, ILIAS\Repository\button(), TableTestBase\getTableFactory(), and ILIAS\UI\examples\ViewControl\Sortation\small().
136 $mapping =
function ($row, $record, $ui_factory, $environment) {
138 ->withHeadline($record[
'headline'])
139 ->withSubheadline($record[
'subhead'])
140 ->withImportantFields($record[
'important_fields'])
141 ->withContent((
new I\
Component\Listing\Descriptive($record[
'content'])))
142 ->withFurtherFieldsHeadline($record[
'further_headline'])
143 ->withFurtherFields($record[
'further_fields'])
148 <div
class=
"il-table-presentation" id=
"id_3">
149 <h3
class=
"ilHeader">title</h3>
150 <div
class=
"il-table-presentation-viewcontrols">
151 <div
class=
"l-bar__space-keeper l-bar__space-keeper--space-between">
152 <div
class=
"l-bar__group">
153 <div
class=
"l-bar__element">
154 <
button class=
"btn btn-default" id=
"id_1">presentation_table_expand</
button>
155 <
button class=
"btn btn-default" id=
"id_2">presentation_table_collapse</button>
158 <div
class=
"l-bar__group"></div>
161 <div
class=
"il-table-presentation-data">
162 <div
class=
"il-table-presentation-row row collapsed" id=
"id_4">
164 <div
class=
"il-table-presentation-row-controls col-lg-auto col-sm-12">
165 <div
class=
"il-table-presentation-row-controls-expander inline">
166 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"expand_content" id=
"id_5">
167 <span
class=
"glyphicon glyphicon-triangle-right" aria-hidden=
"true"></span>
170 <div
class=
"il-table-presentation-row-controls-collapser">
171 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"collapse_content" id=
"id_6">
172 <span
class=
"glyphicon glyphicon-triangle-bottom" aria-hidden=
"true"></span>
177 <div
class=
"il-table-presentation-row-contents col-lg col-sm-12">
179 <div
class=
"il-table-presentation-row-header col-lg col-sm-12">
180 <h4
class=
"il-table-presentation-row-header-headline" onClick=
"$(document).trigger('il_signal...');">some title<br /><
small>some type</
small>
182 <div
class=
"il-table-presentation-row-header-fields">
183 <div
class=
"l-bar__space-keeper">
184 <div
class=
"l-bar__group">
185 <div
class=
"il-table-presentation-row-header-fields-value l-bar__element">important-1</div>
188 <div
class=
"l-bar__space-keeper">
189 <div
class=
"l-bar__group">
190 <div
class=
"il-table-presentation-row-header-fields-value l-bar__element">important-2</div>
193 <button
class=
"btn btn-link" id=
"id_7">presentation_table_more</button>
196 <div
class=
"il-table-presentation-actions col-lg-auto col-sm-12">
197 <button
class=
"btn btn-default" data-action=
"#" id=
"id_8">
do</button><br />
199 <div
class=
"il-table-presentation-row-expanded col-lg-12 col-sm-12">
201 <div
class=
"il-table-presentation-desclist col-lg col-sm-12 desclist-column">
204 <dd>first content</dd>
206 <dd>second content</dd>
209 <div
class=
"il-table-presentation-details col-lg-5 col-sm-12">
210 <div
class=
"il-table-presentation-fields">
211 <h5>further fields</h5>
212 <span
class=
"il-item-property-name">f-1</span>
213 <span
class=
"il-item-property-value">further</span>
215 <span
class=
"il-item-property-name">f-2</span>
216 <span
class=
"il-item-property-value">way further</span>
229 $r = $this->getDefaultRenderer();
231 $pt =
$f->presentation(
'title', [], $mapping);
232 $actual =
$r->render($pt->withData($this->getDummyData()));
234 $this->brutallyTrimHTML($expected),
235 $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
button(string $caption, string $cmd)
small()
description: > This can be used, when space is very scarce and the label cannot be displayed ...
◆ testMinimalRendering()
PresentationTest::testMinimalRendering |
( |
| ) |
|
Definition at line 240 of file PresentationTest.php.
References Vendor\Package\$f, $r, ILIAS\Repository\button(), and TableTestBase\getTableFactory().
242 $mapping =
function ($row, $record, $ui_factory, $environment) {
244 ->withHeadline($record[
'headline'])
245 ->withContent((
new I\
Component\Listing\Descriptive($record[
'content'])));
249 <div
class=
"il-table-presentation" id=
"id_3">
250 <h3
class=
"ilHeader">title</h3>
251 <div
class=
"il-table-presentation-viewcontrols">
253 <div
class=
"l-bar__space-keeper l-bar__space-keeper--space-between">
254 <div
class=
"l-bar__group">
255 <div
class=
"l-bar__element">
257 <
button class=
"btn btn-default" id=
"id_1">presentation_table_expand</
button>
258 <
button class=
"btn btn-default" id=
"id_2">presentation_table_collapse</button>
261 <div
class=
"l-bar__group"></div>
264 <div
class=
"il-table-presentation-data">
265 <div
class=
"il-table-presentation-row row collapsed" id=
"id_4">
267 <div
class=
"il-table-presentation-row-controls col-lg-auto col-sm-12">
268 <div
class=
"il-table-presentation-row-controls-expander inline">
269 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"expand_content" id=
"id_5">
270 <span
class=
"glyphicon glyphicon-triangle-right" aria-hidden=
"true"></span>
273 <div
class=
"il-table-presentation-row-controls-collapser">
274 <a tabindex=
"0" class=
"glyph" href=
"#" aria-label=
"collapse_content" id=
"id_6">
275 <span
class=
"glyphicon glyphicon-triangle-bottom" aria-hidden=
"true"></span>
280 <div
class=
"il-table-presentation-row-contents col-lg col-sm-12">
282 <div
class=
"il-table-presentation-row-header col-lg col-sm-12">
283 <h4
class=
"il-table-presentation-row-header-headline" onClick=
"$(document).trigger('il_signal...');">some title</h4>
284 <div
class=
"il-table-presentation-row-header-fields">
285 <button
class=
"btn btn-link" id=
"id_7">presentation_table_more</button>
288 <div
class=
"il-table-presentation-actions col-lg-auto col-sm-12"></div>
289 <div
class=
"il-table-presentation-row-expanded col-lg-12 col-sm-12">
291 <div
class=
"il-table-presentation-desclist col-lg col-sm-12">
294 <dd>first content</dd>
296 <dd>second content</dd>
308 $r = $this->getDefaultRenderer();
310 $pt =
$f->presentation(
'title', [], $mapping);
311 $actual =
$r->render($pt->withData($this->getDummyData()));
313 $this->brutallyTrimHTML($expected),
314 $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
button(string $caption, string $cmd)
◆ testRenderEmptyTableEntry()
PresentationTest::testRenderEmptyTableEntry |
( |
| ) |
|
◆ testRowConstruction()
PresentationTest::testRowConstruction |
( |
| ) |
|
Definition at line 65 of file PresentationTest.php.
References Vendor\Package\$f, and TableTestBase\getTableFactory().
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()
◆ testTableConstruction()
PresentationTest::testTableConstruction |
( |
| ) |
|
Definition at line 45 of file PresentationTest.php.
References Vendor\Package\$f, and TableTestBase\getTableFactory().
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());
The documentation for this class was generated from the following file: