ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
OrderingRendererTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once("vendor/composer/vendor/autoload.php");
22require_once(__DIR__ . "/TableRendererTestBase.php");
23
26use ILIAS\Data;
27
32{
33 private function getRenderer()
34 {
35 return new Renderer(
36 $this->getUIFactory(),
37 $this->getTemplateFactory(),
38 $this->getLanguage(),
39 $this->getJavaScriptBinding(),
41 new \ILIAS\Data\Factory(),
42 new \ILIAS\UI\Help\TextRetriever\Echoing(),
43 $this->getUploadLimitResolver()
44 );
45 }
46
48 {
49 $renderer = $this->getRenderer();
50 $f = $this->getColumnFactory();
51 $data = new class () implements ILIAS\UI\Component\Table\OrderingRetrieval {
52 public function getRows(
53 Component\Table\OrderingRowBuilder $row_builder,
54 array $visible_column_ids
55 ): \Generator {
56 if (false) {
57 yield;
58 }
59 }
60 };
61 $columns = [
62 'f1' => $f->text("Field 1")->withIndex(1),
63 'f2' => $f->text("Field 2")->withIndex(2),
64 'f3' => $f->number("Field 3")->withIndex(3)
65 ];
66 $uri = new Data\URI('https://localhost');
67 $table = $this->getUIFactory()->table()->ordering($data, $uri, '', $columns)
68 ->withRequest($this->getDummyRequest());
69
70 $actual = $renderer->renderOrderingTable($table, $this->getDefaultRenderer());
71 $expected = <<<EOT
72<div class="c-table-ordering" id="id_1"><h2 class="ilHeader" id="id_1_label"></h2>
73 <div class="viewcontrols">
74 <form class="il-viewcontrols-form l-bar__space-keeper" method="get" id="id_2"></form>
75 </div>
76 <form method="post" class="c-table-data__table-wrapper c-table-ordering__form" action="https://localhost">
77 <table class="c-table-data__table" aria-labelledby="id_1_label" aria-colcount="5" role="grid">
78 <thead>
79 <tr class="c-table-data__header c-table-data__row">
80 <th class="c-table-data__header c-table-data__cell c-table-data__header__rowselection" tabindex="-1" aria-colindex="1"></th>
81 <th class="c-table-data__header c-table-data__cell c-table-data__cell--number" tabindex="-1" aria-colindex="2">
82 <div class="c-table-data__header__resize-wrapper">table_posinput_col_title</div>
83 </th>
84 <th class="c-table-data__header c-table-data__cell c-table-data__cell--text" tabindex="-1" aria-colindex="3">
85 <div class="c-table-data__header__resize-wrapper">Field 1</div>
86 </th>
87 <th class="c-table-data__header c-table-data__cell c-table-data__cell--text" tabindex="-1" aria-colindex="4">
88 <div class="c-table-data__header__resize-wrapper">Field 2</div>
89 </th>
90 <th class="c-table-data__header c-table-data__cell c-table-data__cell--number" tabindex="-1" aria-colindex="5">
91 <div class="c-table-data__header__resize-wrapper">Field 3</div>
92 </th>
93 </tr>
94 </thead>
95 <tbody class="c-table-data__body">
96 <tr>
97 <td class="c-table-data__cell c-table-data__cell--multiaction" colspan="5">
98 <div class="l-bar__space-keeper">
99 <div class="l-bar__element">
100 <div class="c-table-data__multiaction-triggerer"></div>
101 </div>
102 <div class="l-bar__element">
103 <button class="btn btn-default" data-action="" id="id_1">sorting_save</button>
104 </div>
105 </div>
106 </td>
107 </tr>
108 </tbody>
109 </table>
110 </form>
111 <div class="c-table-data__async_modal_container"></div>
112 <div class="c-table-data__async_message modal" role="dialog" id="id_1_msgmodal">
113 <div class="modal-dialog" role="document">
114 <div class="modal-content">
115 <div class="modal-header">
116 <button type="button" class="close" data-dismiss="modal" aria-label="close">
117 <span aria-hidden="true">&times;</span></button>
118 </div>
119 <div class="c-table-data__async_messageresponse modal-body"></div>
120 </div>
121 </div>
122 </div>
123</div>
124EOT;
125 $this->assertEquals($this->brutallyTrimHTML($expected), $this->brutallyTrimHTML($actual));
126 }
127}
$renderer
Builds data types.
Definition: Factory.php:36
Definition: UI.php:24
Tests for the Renderer of DataTables.
Tests for the Renderer of DataTables.
form( $class_path, string $cmd, string $submit_caption="")
button(string $caption, string $cmd)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
getLanguage()