4 require_once(
"libs/composer/vendor/autoload.php");
5 require_once(__DIR__ .
"/../../Base.php");
7 use \ILIAS\UI\Component as
C;
8 use \ILIAS\UI\Implementation\Component as
IC;
18 $factory =
new class extends NoUIFactory {
19 public function symbol() : C\Symbol\Factory
21 return new IC\Symbol\Factory(
22 new IC\Symbol\Icon\Factory(),
23 new IC\Symbol\Glyph\Factory(),
24 new IC\Symbol\Avatar\Factory()
27 public function button()
31 public function dropdown()
33 return new IC\Dropdown\Factory();
42 return new \ILIAS\UI\Implementation\Component\ViewControl\Factory($sg);
48 $pagination =
$f->pagination();
49 $this->assertInstanceOf(
50 "ILIAS\\UI\\Component\\ViewControl\\Pagination",
53 $this->assertInstanceOf(
54 "ILIAS\\UI\\Component\\Signal",
55 $pagination->getInternalSignal()
65 $target_url =
'http://testurl';
66 $parameter_name =
"param_name";
67 $max_page_options = 10;
71 ->withTargetURL($target_url, $parameter_name)
72 ->withTotalEntries($total_entries)
73 ->withPageSize($page_size)
74 ->withCurrentPage($current_page)
75 ->withMaxPaginationButtons($max_page_options)
78 $this->assertEquals($target_url, $p->getTargetURL());
79 $this->assertEquals($parameter_name, $p->getParameterName());
80 $this->assertEquals($page_size, $p->getPageSize());
81 $this->assertEquals($current_page, $p->getCurrentPage());
82 $this->assertEquals($max_page_options, $p->getMaxPaginationButtons());
83 $this->assertEquals(2, $p->getNumberOfPages());
94 $expected_html = <<<EOT
95 <div
class=
"il-viewcontrol-pagination">
96 <span
class=
"browse previous">
97 <a
class=
"glyph disabled" aria-label=
"back" aria-
disabled=
"true">
98 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
102 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
103 <button
class=
"btn btn-link" data-action=
"?pagination_offset=1" id=
"id_2">2</button>
105 <span
class=
"browse next">
106 <a
class=
"glyph" href=
"?pagination_offset=1" aria-label=
"next">
107 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
120 ->withTotalEntries(2)
122 ->withCurrentPage(1);
126 $expected_html = <<<EOT
127 <div
class=
"il-viewcontrol-pagination">
128 <span
class=
"browse previous">
129 <a
class=
"glyph" href=
"?pagination_offset=0" aria-label=
"back">
130 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
134 <button
class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
135 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=1" id=
"id_2">2</button>
137 <span
class=
"browse next">
138 <a
class=
"glyph disabled" aria-label=
"next" aria-
disabled=
"true">
139 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
152 ->withTotalEntries(3)
154 ->withMaxPaginationButtons(1);
159 $expected_html = <<<EOT
160 <div
class=
"il-viewcontrol-pagination">
161 <span
class=
"browse previous">
162 <a
class=
"glyph disabled" aria-label=
"back" aria-
disabled=
"true">
163 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
167 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
170 <button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_2">3</button>
173 <span
class=
"browse next">
174 <a
class=
"glyph" href=
"?pagination_offset=1" aria-label=
"next">
175 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
187 ->withTotalEntries(3)
189 ->withMaxPaginationButtons(1)
190 ->withCurrentPage(1);
195 $expected_html = <<<EOT
196 <div
class=
"il-viewcontrol-pagination">
197 <span
class=
"browse previous">
198 <a
class=
"glyph" href=
"?pagination_offset=0" aria-label=
"back">
199 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
204 <button
class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_2">1</button>
207 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=1" id=
"id_1">2</button>
210 <button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_3">3</button>
213 <span
class=
"browse next">
214 <a
class=
"glyph" href=
"?pagination_offset=2" aria-label=
"next">
215 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
227 ->withTotalEntries(3)
229 ->withMaxPaginationButtons(1)
230 ->withCurrentPage(2);
235 $expected_html = <<<EOT
236 <div
class=
"il-viewcontrol-pagination">
237 <span
class=
"browse previous">
238 <a
class=
"glyph" href=
"?pagination_offset=1" aria-label=
"back">
239 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
243 <button
class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_2">1</button>
246 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=2" id=
"id_1">3</button>
248 <span
class=
"browse next">
249 <a
class=
"glyph disabled" aria-label=
"next" aria-
disabled=
"true">
250 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
264 ->withTotalEntries(3)
268 $expected_html = <<<EOT
269 <div
class=
"il-viewcontrol-pagination">
270 <span
class=
"browse previous">
271 <a
class=
"glyph disabled" aria-label=
"back" aria-
disabled=
"true">
272 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
276 <div
class=
"dropdown">
277 <button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-haspopup=
"true" aria-expanded=
"false">pagination_label_x_of_y <span
class=
"caret"></span></button>
278 <ul
class=
"dropdown-menu">
279 <li><button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=0" id=
"id_1">1</button></li>
280 <li><button
class=
"btn btn-link" data-action=
"?pagination_offset=1" id=
"id_2">2</button></li>
281 <li><button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_3">3</button></li>
285 <span
class=
"browse next">
286 <a
class=
"glyph" href=
"?pagination_offset=1" aria-label=
"next">
287 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
Provides common functionality for UI tests.
disabled()
Example showing how to plug a disabled checkbox into a form.
assertHTMLEquals($expected_html_as_string, $html_as_string)
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])