3declare(strict_types=1);
21require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
22require_once(__DIR__ .
"/../../Base.php");
33 private I\Component\Symbol\Glyph\Glyph
$glyph;
34 private I\Component\Symbol\Icon\Standard
$icon;
38 $this->button_factory =
new I\Component\Button\Factory();
39 $this->glyph =
new I\Component\Symbol\Glyph\Glyph(
"briefcase",
"briefcase");
40 $this->icon =
new I\Component\Symbol\Icon\Standard(
"someExample",
"Example",
"small",
false);
45 $this->assertInstanceOf(
46 "ILIAS\\UI\\Component\\Button\\Bulky",
47 $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de")
51 public function test_construction_icon_type_wrong(): void
53 $this->expectException(TypeError::class);
58 $f->bulky(
$c,
"",
"http://www.ilias.de");
63 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de");
72 $b = $this->button_factory->bulky($this->icon,
"label",
"http://www.ilias.de");
81 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de");
82 $this->assertFalse(
$b->isEngaged());
83 $this->assertFalse(
$b->isEngageable());
85 $b =
$b->withEngagedState(
true);
86 $this->assertInstanceOf(
87 "ILIAS\\UI\\Component\\Button\\Bulky",
90 $this->assertTrue(
$b->isEngaged());
91 $this->assertTrue(
$b->isEngageable());
96 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de");
97 $this->assertFalse(
$b->isEngaged());
98 $this->assertFalse(
$b->isEngageable());
100 $b =
$b->withEngagedState(
false);
101 $this->assertInstanceOf(
102 "ILIAS\\UI\\Component\\Button\\Bulky",
105 $this->assertFalse(
$b->isEngaged());
106 $this->assertTrue(
$b->isEngageable());
112 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de")
114 $this->assertEquals(
"menuitem",
$b->getAriaRole());
115 }
catch (InvalidArgumentException
$e) {
116 $this->assertFalse(
"This should not happen");
123 $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de")
124 ->withAriaRole(
"loremipsum");
125 $this->assertFalse(
"This should not happen");
126 }
catch (InvalidArgumentException
$e) {
127 $this->assertTrue(
true);
134 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de");
145 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de")
146 ->withEngagedState(
true);
157 $b = $this->button_factory->bulky($this->glyph,
"label",
"http://www.ilias.de")
158 ->withEngagedState(
true);
165 protected function getHtmlWithGlyph(
bool $engeagable =
false,
bool $engeaged =
false): string
171 $aria_pressed =
" aria-pressed='true'";
172 $engaged_class =
" engaged";
174 $aria_pressed =
" aria-pressed='false'";
175 $engaged_class =
" disengaged";
179 .
'<button class="btn btn-bulky' . $engaged_class .
'" data-action="http://www.ilias.de" id="id_1" ' . $aria_pressed .
'>'
180 .
' <span class="glyph" role="img">'
181 .
' <span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>'
183 .
' <span class="bulky-label">label</span>'
190 $b = $this->button_factory->bulky($this->icon,
"label",
"http://www.ilias.de");
193 .
'<button class="btn btn-bulky" data-action="http://www.ilias.de" id="id_1">'
194 .
' <img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt=""/>'
195 .
' <span class="bulky-label">label</span>'
207 $b = $this->button_factory->bulky($this->icon,
"label",
"http://www.ilias.de")
211 .
'<button class="btn btn-bulky" data-action="http://www.ilias.de" id="id_1" role="menuitem">'
212 .
' <img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt=""/>'
213 .
' <span class="bulky-label">label</span>'
225 $b = $this->button_factory->bulky($this->icon,
"label",
"http://www.ilias.de")
226 ->withEngagedState(
false)
230 .
'<button class="btn btn-bulky" data-action="http://www.ilias.de" id="id_1" role="menuitem" aria-haspopup="true">'
231 .
' <img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt=""/>'
232 .
' <span class="bulky-label">label</span>'
244 $b = $this->button_factory->bulky($this->icon,
"Example",
"http://www.ilias.de")
245 ->withEngagedState(
false)
249 .
'<button class="btn btn-bulky" data-action="http://www.ilias.de" id="id_1" role="menuitem" aria-haspopup="true">'
250 .
' <img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt=""/>'
251 .
' <span class="bulky-label">Example</span>'
Provides common functionality for UI tests.
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...