3 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
31 "ILIAS" =>
"http://www.ilias.de",
32 "Github" =>
"http://www.github.com" 36 protected string $role =
"group";
48 $back =
new I\Component\Button\Standard(
"",
"http://www.ilias.de");
49 $next =
new I\Component\Button\Standard(
"",
"http://www.github.com");
50 $button =
new I\Component\Button\Standard(
"Today",
"");
52 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Button\\Button", $back);
53 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Button\\Button", $next);
54 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Button\\Button", $button);
55 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\ViewControl\\Factory", $view_control_f);
57 $section = $view_control_f->section($back, $button, $next);
58 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\ViewControl\\Section", $section);
65 $back = $button_f->standard(
"",
"http://www.ilias.de");
66 $next = $button_f->standard(
"",
"http://www.github.com");
67 $button = $button_f->standard(
"Today",
"");
71 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Button\\Button", $action);
78 $back = $button_f->standard(
"",
"http://www.ilias.de");
79 $next = $button_f->standard(
"",
"http://www.github.com");
80 $button = $button_f->standard(
"Today",
"");
84 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Button\\Button", $action);
94 $back = $button_f->standard(
"",
"http://www.ilias.de");
95 $next = $button_f->standard(
"",
"http://www.github.com");
96 $button = $button_f->standard(
"Today",
"");
98 $section = $view_control_f->section($back, $button, $next);
100 $html = $r->render($section);
101 $this->assertStringContainsString(
"glyphicon-chevron-left", $html);
102 $this->assertStringContainsString(
"glyphicon-chevron-right", $html);
103 $this->assertStringContainsString(
"il-viewcontrol-section", $html);
104 $this->assertStringContainsString(
"btn", $html);
110 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\ViewControl\\Factory",
$f);
117 $this->assertEquals($this->active,
$f->mode($this->actions, $this->aria_label)->withActive($this->active)->getActive());
118 $this->assertNotEquals($this->active,
$f->mode($this->actions, $this->aria_label)->withActive(
"Dummy text")->getActive());
125 $this->assertIsArray(
$f->mode($this->actions, $this->aria_label)->getLabelledActions());
132 $mode =
$f->mode($this->actions, $this->aria_label);
136 $activate_first_item =
false;
137 $active = $mode->getActive();
139 $activate_first_item =
true;
142 $expected =
"<div class=\"btn-group il-viewcontrol-mode\" aria-label=\"" . $this->aria_label .
"\" role=\"" . $this->role .
"\">";
143 foreach ($this->actions as $label => $action) {
144 if ($activate_first_item) {
145 $expected .=
"<button class=\"btn btn-default engaged\" aria-label=\"$label\" aria-pressed=\"true\" data-action=\"$action\" id=\"id_1\">$label</button>";
146 $activate_first_item =
false;
147 } elseif ($active == $label) {
148 $expected .=
"<button class=\"btn btn-default engaged\" aria-label=\"$label\" aria-pressed=\"true\" data-action=\"$action\" id=\"id_1\">$label</button>";
150 $expected .=
"<button class=\"btn btn-default\" aria-label=\"$label\" aria-pressed=\"false\" data-action=\"$action\" id=\"id_2\">$label</button>";
153 $expected .=
"</div>";
161 public function counter(): C\Counter\Factory
163 return new I\Component\Counter\Factory();
165 public function button(): C\Button\Factory
167 return new I\Component\Button\Factory();
175 <div
class=
"il-viewcontrol-section">
176 <a
class=
"btn btn-default " href=
"http://www.ilias.de" aria-label=
"previous" data-action=
"http://www.ilias.de" id=
"id_1"><span
class=
"glyphicon glyphicon-chevron-left"></span></a>
177 <button
class=
"btn btn-default" data-action=
"">Today</button>
178 <a
class=
"btn btn-default " href=
"http://www.github.com" aria-label=
"next" data-action=
"http://www.github.com" id=
"id_2"><span
class=
"glyphicon glyphicon-chevron-right"></span></a>
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
test_implements_factory_interface()
test_viewcontrol_section_get_previous_actions()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_render_viewcontrol_mode()
test_viewcontrol_section_get_next_actions()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_render_viewcontrol_section()
test_viewcontrol_with_active()
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Provides common functionality for UI tests.
test_viewcontrol_get_actions()
normalizeHTML(string $html)