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;
19 return new \ILIAS\UI\Implementation\Factory(
20 $this->createMock(
C\Counter\Factory::class),
21 new IC\Glyph\Factory($sg),
23 $this->createMock(
C\Listing\Factory::class),
24 $this->createMock(
C\Image\Factory::class),
25 $this->createMock(
C\Panel\Factory::class),
26 $this->createMock(
C\Modal\Factory::class),
27 $this->createMock(
C\Dropzone\Factory::class),
28 $this->createMock(
C\Popover\Factory::class),
29 $this->createMock(
C\Divider\Factory::class),
30 $this->createMock(
C\Link\Factory::class),
31 new IC\Dropdown\Factory(),
32 $this->createMock(
C\Item\Factory::class),
33 $this->createMock(
C\Icon\Factory::class),
34 $this->createMock(
C\ViewControl\Factory::class),
35 $this->createMock(
C\Chart\Factory::class),
36 $this->createMock(
C\Input\Factory::class),
37 $this->createMock(
C\Table\Factory::class),
38 $this->createMock(
C\MessageBox\Factory::class),
39 $this->createMock(
C\
Card\Factory::class)
46 return new \ILIAS\UI\Implementation\Component\ViewControl\Factory($sg);
52 $pagination =
$f->pagination();
53 $this->assertInstanceOf(
54 "ILIAS\\UI\\Component\\ViewControl\\Pagination",
57 $this->assertInstanceOf(
58 "ILIAS\\UI\\Component\\Signal",
59 $pagination->getInternalSignal()
69 $target_url =
'http://testurl';
70 $parameter_name =
"param_name";
71 $max_page_options = 10;
75 ->withTargetURL($target_url, $parameter_name)
76 ->withTotalEntries($total_entries)
77 ->withPageSize($page_size)
78 ->withCurrentPage($current_page)
79 ->withMaxPaginationButtons($max_page_options)
82 $this->assertEquals($target_url, $p->getTargetURL());
83 $this->assertEquals($parameter_name, $p->getParameterName());
84 $this->assertEquals($page_size, $p->getPageSize());
85 $this->assertEquals($current_page, $p->getCurrentPage());
86 $this->assertEquals($max_page_options, $p->getMaxPaginationButtons());
87 $this->assertEquals(2, $p->getNumberOfPages());
88 $this->assertEquals(11, $p->getPageLength());
99 $expected_html = <<<EOT
100 <div
class=
"il-viewcontrol-pagination">
101 <span
class=
"browse previous">
102 <
a class=
"glyph disabled" aria-label=
"back" aria-disabled=
"true">
103 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
107 <button
class=
"btn btn-link ilSubmitInactive disabled" data-action=
"?pagination_offset=0">1</button>
108 <button
class=
"btn btn-link" data-action=
"?pagination_offset=1" id=
"id_1">2</button>
110 <span
class=
"browse next">
111 <
a class=
"glyph" href=
"?pagination_offset=1" aria-label=
"next">
112 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
125 ->withTotalEntries(2)
127 ->withCurrentPage(1);
131 $expected_html = <<<EOT
132 <div
class=
"il-viewcontrol-pagination">
133 <span
class=
"browse previous">
134 <
a class=
"glyph" href=
"?pagination_offset=0" aria-label=
"back">
135 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
139 <button
class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
140 <button
class=
"btn btn-link ilSubmitInactive disabled" data-action=
"?pagination_offset=1">2</button>
142 <span
class=
"browse next">
143 <
a class=
"glyph disabled" aria-label=
"next" aria-disabled=
"true">
144 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
157 ->withTotalEntries(3)
159 ->withMaxPaginationButtons(1);
164 $expected_html = <<<EOT
165 <div
class=
"il-viewcontrol-pagination">
166 <span
class=
"browse previous">
167 <
a class=
"glyph disabled" aria-label=
"back" aria-disabled=
"true">
168 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
172 <button
class=
"btn btn-link ilSubmitInactive disabled" data-action=
"?pagination_offset=0">1</button>
175 <button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_1">3</button>
178 <span
class=
"browse next">
179 <
a class=
"glyph" href=
"?pagination_offset=1" aria-label=
"next">
180 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
192 ->withTotalEntries(3)
194 ->withMaxPaginationButtons(1)
195 ->withCurrentPage(1);
200 $expected_html = <<<EOT
201 <div
class=
"il-viewcontrol-pagination">
202 <span
class=
"browse previous">
203 <
a class=
"glyph" href=
"?pagination_offset=0" aria-label=
"back">
204 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
209 <button
class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
212 <button
class=
"btn btn-link ilSubmitInactive disabled" data-action=
"?pagination_offset=1">2</button>
215 <button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_2">3</button>
218 <span
class=
"browse next">
219 <
a class=
"glyph" href=
"?pagination_offset=2" aria-label=
"next">
220 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
232 ->withTotalEntries(3)
234 ->withMaxPaginationButtons(1)
235 ->withCurrentPage(2);
240 $expected_html = <<<EOT
241 <div
class=
"il-viewcontrol-pagination">
242 <span
class=
"browse previous">
243 <
a class=
"glyph" href=
"?pagination_offset=1" aria-label=
"back">
244 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
248 <button
class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
251 <button
class=
"btn btn-link ilSubmitInactive disabled" data-action=
"?pagination_offset=2">3</button>
253 <span
class=
"browse next">
254 <
a class=
"glyph disabled" aria-label=
"next" aria-disabled=
"true">
255 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
269 ->withTotalEntries(3)
273 $expected_html = <<<EOT
274 <div
class=
"il-viewcontrol-pagination">
275 <span
class=
"browse previous">
276 <
a class=
"glyph disabled" aria-label=
"back" aria-disabled=
"true">
277 <span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span>
281 <div
class=
"dropdown">
282 <button
class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-haspopup=
"true" aria-expanded=
"false">1 <span
class=
"caret"></span></button>
283 <ul
class=
"dropdown-menu">
284 <li><button
class=
"btn btn-link ilSubmitInactive disabled" data-action=
"?pagination_offset=0">1</button></li>
285 <li><button
class=
"btn btn-link" data-action=
"?pagination_offset=1" id=
"id_1">2</button></li>
286 <li><button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_2">3</button></li>
290 <span
class=
"browse next">
291 <
a class=
"glyph" href=
"?pagination_offset=1" aria-label=
"next">
292 <span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span>
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Provides common functionality for UI tests.
assertHTMLEquals($expected_html_as_string, $html_as_string)