19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
34 'internal_rating' =>
'Best',
35 'date_desc' =>
'Most Recent',
36 'date_asc' =>
'Oldest',
41 return new I\Component\ViewControl\Factory(
49 $sortation =
$f->sortation($this->options,
'date_desc');
50 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\ViewControl\\Sortation", $sortation);
51 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $sortation->getSelectSignal());
56 $this->expectException(\InvalidArgumentException::class);
58 $sortation =
$f->sortation($this->options,
'not_in_options');
64 $s =
$f->sortation($this->options,
'date_desc');
66 $this->assertEquals($this->options, $s->getOptions());
68 $s = $s->withTargetURL(
'#',
'param');
69 $this->assertEquals(
'#', $s->getTargetURL());
70 $this->assertEquals(
'param', $s->getParameterName());
72 $this->assertEquals(array(), $s->getTriggeredSignals());
74 $signal = $generator->create();
75 $this->assertEquals($signal, $s->withOnSort($signal)->getTriggeredSignals()[0]->getSignal());
76 $this->assertEquals(
'internal_rating', $s->withSelected(
'internal_rating')->getSelected());
82 $r = $this->getDefaultRenderer();
83 $s =
$f->sortation($this->options,
'date_desc');
86 <div
class=
"dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id=
"id_1">
87 <
button class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"sortation" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_1_ctrl">
88 <span
class=
"label">vc_sort Most Recent</span>
89 <span
class=
"glyphicon-sort"></span>
91 <ul
id=
"id_1_ctrl" class=
"dropdown-menu">
92 <li><
button class=
"btn btn-link" data-action=
"?sortation=internal_rating" id=
"id_2">Best</button></li>
93 <li
class=
"selected"><button
class=
"btn btn-link" data-action=
"?sortation=date_desc" id=
"id_3">Most Recent</button></li>
94 <li><button
class=
"btn btn-link" data-action=
"?sortation=date_asc" id=
"id_4">Oldest</button></li>
98 $html = $this->brutallyTrimHTML(
$r->render($s));
99 $this->assertEquals($this->brutallyTrimHTML($expected), $html);
105 $r = $this->getDefaultRenderer();
106 $s =
$f->sortation($this->options,
'internal_rating')
107 ->withSelected(
'date_desc');
110 <div
class=
"dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id=
"id_1">
111 <
button class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"sortation" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_1_ctrl">
112 <span
class=
"label">vc_sort Most Recent</span>
113 <span
class=
"glyphicon-sort"></span>
115 <ul
id=
"id_1_ctrl" class=
"dropdown-menu">
116 <li><
button class=
"btn btn-link" data-action=
"?sortation=internal_rating" id=
"id_2">Best</button></li>
117 <li
class=
"selected"><button
class=
"btn btn-link" data-action=
"?sortation=date_desc" id=
"id_3">Most Recent</button></li>
118 <li><button
class=
"btn btn-link" data-action=
"?sortation=date_asc" id=
"id_4">Oldest</button></li>
122 $html = $this->brutallyTrimHTML(
$r->render($s));
123 $this->assertEquals($this->brutallyTrimHTML($expected), $html);
129 $r = $this->getDefaultRenderer();
130 $s =
$f->sortation($this->options, array_key_first($this->options))
131 ->withAdditionalOnLoadCode(
138 $id_ctrl =
"id_1_ctrl";
139 $button1_id =
"id_2";
140 $button2_id =
"id_3";
141 $button3_id =
"id_4";
142 $dropdown_id =
"id_5";
143 $dropdown_menu_id = $dropdown_id .
"_menu";
146 <div
class=
"dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element"$id>
147 <
button class=
"btn btn-default dropdown-toggle" type=
"button" data-toggle=
"dropdown" aria-label=
"sortation" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"{$id_ctrl}">
148 <span
class=
"label">vc_sort Best</span>
149 <span
class=
"glyphicon-sort"></span>
151 <ul
id=
"{$id_ctrl}" class=
"dropdown-menu">
152 <li
class=
"selected"><button
class=
"btn btn-link" data-action=
"?sortation=internal_rating" id=
"$button1_id">Best</button></li>
153 <li><button
class=
"btn btn-link" data-action=
"?sortation=date_desc" id=
"$button2_id">Most Recent</button></li>
154 <li><button
class=
"btn btn-link" data-action=
"?sortation=date_asc" id=
"$button3_id">Oldest</button></li>
158 $html = $this->brutallyTrimHTML(
$r->render($s));
159 $this->assertEquals($this->brutallyTrimHTML($expected), $html);
165 public function button(): I\Component\Button\Factory
167 return new I\Component\Button\Factory();
169 public function dropdown(): I\Component\Dropdown\Factory
171 return new I\Component\Dropdown\Factory();
button(string $caption, string $cmd)
testRenderingWithSelected()
testRenderingWithJsBinding()
Test on icon implementation.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins