3 declare(strict_types=1);
21 require_once(
"libs/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
37 return new I\Symbol\Glyph\Factory();
42 return new I\Counter\Factory();
46 G\Glyph::SETTINGS =>
"glyphicon glyphicon-cog",
47 G\Glyph::EXPAND =>
"glyphicon glyphicon-triangle-right",
48 G\Glyph::COLLAPSE =>
"glyphicon glyphicon-triangle-bottom",
49 G\Glyph::ADD =>
"glyphicon glyphicon-plus-sign",
50 G\Glyph::REMOVE =>
"glyphicon glyphicon-minus-sign",
51 G\Glyph::UP =>
"glyphicon glyphicon-circle-arrow-up",
52 G\Glyph::DOWN =>
"glyphicon glyphicon-circle-arrow-down",
53 G\Glyph::BACK =>
"glyphicon glyphicon-chevron-left",
54 G\Glyph::NEXT =>
"glyphicon glyphicon-chevron-right",
55 G\Glyph::SORT_ASCENDING =>
"glyphicon glyphicon-arrow-up",
56 G\Glyph::SORT_DESCENDING =>
"glyphicon glyphicon-arrow-down",
57 G\Glyph::USER =>
"glyphicon glyphicon-user",
58 G\Glyph::MAIL =>
"glyphicon glyphicon-envelope",
59 G\Glyph::NOTIFICATION =>
"glyphicon glyphicon-bell",
60 G\Glyph::TAG =>
"glyphicon glyphicon-tag",
61 G\Glyph::NOTE =>
"glyphicon glyphicon-pushpin",
62 G\Glyph::COMMENT =>
"glyphicon glyphicon-comment",
63 G\Glyph::BRIEFCASE =>
"glyphicon glyphicon-briefcase",
64 G\Glyph::LIKE =>
"glyphicon il-glyphicon-like",
65 G\Glyph::LOVE =>
"glyphicon il-glyphicon-love",
66 G\Glyph::DISLIKE =>
"glyphicon il-glyphicon-dislike",
67 G\Glyph::LAUGH =>
"glyphicon il-glyphicon-laugh",
68 G\Glyph::ASTOUNDED =>
"glyphicon il-glyphicon-astounded",
69 G\Glyph::SAD =>
"glyphicon il-glyphicon-sad",
70 G\Glyph::ANGRY =>
"glyphicon il-glyphicon-angry",
71 G\Glyph::EYEOPEN =>
"glyphicon glyphicon-eye-open",
72 G\Glyph::EYECLOSED =>
"glyphicon glyphicon-eye-close",
73 G\Glyph::ATTACHMENT =>
"glyphicon glyphicon-paperclip",
74 G\Glyph::RESET =>
"glyphicon glyphicon-repeat",
75 G\Glyph::APPLY =>
"glyphicon glyphicon-ok",
76 G\Glyph::SEARCH =>
"glyphicon glyphicon-search",
77 G\Glyph::HELP =>
"glyphicon glyphicon-question-sign",
78 G\Glyph::CALENDAR =>
"glyphicon glyphicon-calendar",
79 G\Glyph::TIME =>
"glyphicon glyphicon-time",
80 G\Glyph::CLOSE =>
"glyphicon glyphicon-remove",
81 G\Glyph::MORE =>
"glyphicon glyphicon-option-horizontal",
82 G\Glyph::DISCLOSURE =>
"glyphicon glyphicon-option-vertical",
83 G\Glyph::LANGUAGE =>
"glyphicon glyphicon-lang",
84 G\Glyph::LOGIN =>
"glyphicon glyphicon-login",
85 G\Glyph::LOGOUT =>
"glyphicon glyphicon-logout",
86 G\Glyph::BULLETLIST =>
"glyphicon glyphicon-bulletlist",
87 G\Glyph::NUMBEREDLIST =>
"glyphicon glyphicon-numberedlist",
88 G\Glyph::LISTINDENT =>
"glyphicon glyphicon-listindent",
89 G\Glyph::LISTOUTDENT =>
"glyphicon glyphicon-listoutdent",
90 G\Glyph::FILTER =>
"glyphicon glyphicon-filter",
91 G\Glyph::COLLAPSE_HORIZONTAL =>
"glyphicon glyphicon-triangle-left" 95 G\Glyph::SETTINGS =>
"settings",
96 G\Glyph::EXPAND =>
"expand_content",
97 G\Glyph::COLLAPSE =>
"collapse_content",
98 G\Glyph::ADD =>
"add",
99 G\Glyph::REMOVE =>
"remove",
101 G\Glyph::DOWN =>
"down",
102 G\Glyph::BACK =>
"back",
103 G\Glyph::NEXT =>
"next",
104 G\Glyph::SORT_ASCENDING =>
"sort_ascending",
105 G\Glyph::SORT_DESCENDING =>
"sort_descending",
106 G\Glyph::USER =>
"show_who_is_online",
107 G\Glyph::MAIL =>
"mail",
108 G\Glyph::NOTIFICATION =>
"notifications",
109 G\Glyph::TAG =>
"tags",
110 G\Glyph::NOTE =>
"notes",
111 G\Glyph::COMMENT =>
"comments",
112 G\Glyph::BRIEFCASE =>
"briefcase",
113 G\Glyph::LIKE =>
"like",
114 G\Glyph::LOVE =>
"love",
115 G\Glyph::DISLIKE =>
"dislike",
116 G\Glyph::LAUGH =>
"laugh",
117 G\Glyph::ASTOUNDED =>
"astounded",
118 G\Glyph::SAD =>
"sad",
119 G\Glyph::ANGRY =>
"angry",
120 G\Glyph::EYEOPEN =>
"eyeopened",
121 G\Glyph::EYECLOSED =>
"eyeclosed",
122 G\Glyph::ATTACHMENT =>
"attachment",
123 G\Glyph::RESET =>
"reset",
124 G\Glyph::APPLY =>
"apply",
125 G\Glyph::SEARCH =>
"search",
126 G\Glyph::HELP =>
"help",
127 G\Glyph::CALENDAR =>
"calendar",
128 G\Glyph::TIME =>
"time",
129 G\Glyph::CLOSE =>
"close",
130 G\Glyph::MORE =>
"show_more",
131 G\Glyph::DISCLOSURE =>
"disclose",
132 G\Glyph::LANGUAGE =>
"switch_language",
133 G\Glyph::LOGIN =>
"log_in",
134 G\Glyph::LOGOUT =>
"log_out",
135 G\Glyph::BULLETLIST =>
"bulletlist",
136 G\Glyph::NUMBEREDLIST =>
"numberedlist",
137 G\Glyph::LISTINDENT =>
"listindent",
138 G\Glyph::LISTOUTDENT =>
"listoutdent",
139 G\Glyph::FILTER =>
"filter",
140 G\Glyph::COLLAPSE_HORIZONTAL =>
"collapse/back" 150 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Glyph\\Factory",
$f);
151 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Glyph\\Glyph",
$f->$factory_method(
"http://www.ilias.de"));
160 $g =
$f->$factory_method();
162 $this->assertNotNull($g);
163 $this->assertEquals($factory_method, $g->getType());
172 $g =
$f->$factory_method(
"http://www.ilias.de");
174 $this->assertNotNull($g);
175 $this->assertEquals(
"http://www.ilias.de", $g->getAction());
184 $g =
$f->$factory_method();
186 $this->assertNotNull($g);
187 $this->assertEquals(null, $g->getAction());
196 $g =
$f->$factory_method();
197 $g2 =
$f->$factory_method()->withUnavailableAction();
199 $this->assertTrue($g->isActive());
200 $this->assertFalse($g2->isActive());
208 $g2 = $g->withHighlight();
210 $this->assertFalse($g->isHighlighted());
211 $this->assertTrue($g2->isHighlighted());
220 $g =
$f->$factory_method();
222 $this->assertCount(0, $g->getCounters());
237 $cf->$counter_type($number)
240 $counters = $g->getCounters();
241 $this->assertCount(1, $counters);
243 $this->assertEquals($counter_type,
$c->getType());
244 $this->assertEquals($number,
$c->getNumber());
257 $cf->status($number_s)
260 $cf->novelty($number_n)
263 $counters = $g->getCounters();
264 $this->assertCount(2, $counters);
265 $vals = array_map(
function (
$c) {
266 return array(
$c->getType(),
$c->getNumber());
268 $this->assertContains(array(
"status", $number_s), $vals);
269 $this->assertContains(array(
"novelty", $number_n), $vals);
283 $cf->status($number_s)
286 $cf->novelty($number_n1)
289 $cf->novelty($number_n2)
292 $counters = $g->getCounters();
293 $this->assertCount(2, $counters);
294 $vals = array_map(
function (
$c) {
295 return array(
$c->getType(),
$c->getNumber());
297 $this->assertContains(array(
"status", $number_s), $vals);
298 $this->assertContains(array(
"novelty", $number_n2), $vals);
312 $counters = $g->getCounters();
313 $this->assertCount(0, $counters);
318 $this->expectException(InvalidArgumentException::class);
319 new Glyph(
"FOO",
"http://www.ilias.de");
325 $constant_values = array_values($glyph_reflection->getConstants());
326 return array_map(
function ($val) {
328 }, $constant_values);
346 $c =
$f->$type(
"http://www.ilias.de");
350 $css_classes = self::$canonical_css_classes[
$type];
351 $aria_label = self::$aria_labels[
$type];
353 $expected =
'<a tabindex="0" class="glyph" href="http://www.ilias.de" aria-label="' . $aria_label .
'"><span class="' . $css_classes .
'" aria-hidden="true"></span></a>';
354 $this->assertEquals($expected, $html);
364 $c =
$f->$type(
"http://www.ilias.de")->withUnavailableAction();
368 $css_classes = self::$canonical_css_classes[
$type];
369 $aria_label = self::$aria_labels[
$type];
372 <a class="glyph disabled" aria-label="' . $aria_label .
'" aria-disabled="true"> 373 <span class="' . $css_classes .
'" aria-hidden="true"></span> 386 $c = $fg->mail(
"http://www.ilias.de")->withCounter($fc->$type(42));
394 <a tabindex="0" class="glyph" href="http://www.ilias.de" aria-label="' . $aria_label .
'"> 395 <span class="' . $css_classes .
'" aria-hidden="true"></span> 396 <span class="il-counter"><span class="badge badge-notify il-counter-' . $type .
'">42</span></span> 397 <span class="il-counter-spacer">42</span> 407 $c = $fg->mail(
"http://www.ilias.de")
408 ->withCounter($fc->novelty(42))
409 ->withCounter($fc->status(7));
415 $expected =
"<a tabindex=\"0\" class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\">" .
416 "<span class=\"$css_classes\" aria-hidden=\"true\"></span>" .
417 "<span class=\"il-counter\"><span class=\"badge badge-notify il-counter-status\">7</span></span>" .
418 "<span class=\"il-counter\"><span class=\"badge badge-notify il-counter-novelty\">42</span></span>" .
419 "<span class=\"il-counter-spacer\">42</span>" .
426 $this->expectException(LogicException::class);
449 $c =
$f->$type(
"http://www.ilias.de")
450 ->withOnLoadCode(
function (
$id) use (&$ids):
string {
457 $this->assertCount(1, $ids);
459 $css_classes = self::$canonical_css_classes[
$type];
460 $aria_label = self::$aria_labels[
$type];
463 $expected =
"<a tabindex=\"0\" class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\" id=\"$id\"><span class=\"$css_classes\" aria-hidden=\"true\"></span></a>";
464 $this->assertEquals($expected, $html);
474 $c =
$f->$type(
"http://www.ilias.de");
475 $c =
$c->withAction(
"http://www.ilias.de/open-source-lms-ilias/");
479 $css_classes = self::$canonical_css_classes[
$type];
480 $aria_label = self::$aria_labels[
$type];
482 $expected =
"<a tabindex=\"0\" class=\"glyph\" href=\"http://www.ilias.de/open-source-lms-ilias/\" aria-label=\"$aria_label\"><span class=\"$css_classes\" aria-hidden=\"true\"></span></a>";
483 $this->assertEquals($expected, $html);
493 $this->assertFalse(
$c->isTabbable());
496 $c =
$f->user()->withAction(
"#");
497 $this->assertTrue($c->isTabbable());
500 $c =
$f->user()->withOnClick(
new I\Signal(
"id_1",
"click"));
501 $this->assertTrue($c->isTabbable());
504 $c =
$f->user()->withAction(
"#")->withOnClick(
new I\Signal(
"id_1",
"click"));
505 $this->assertTrue($c->isTabbable());
508 $c =
$f->user()->withAction(
"#")->withOnClick(
new I\Signal(
"id_1",
"click"))->withUnavailableAction();
509 $this->assertFalse($c->isTabbable());
519 $expected =
'<a class="glyph" aria-label="show_who_is_online"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a>';
521 $this->assertEquals($expected, $html);
524 $c =
$f->user()->withAction(
"#");
525 $expected =
'<a tabindex="0" class="glyph" href="#" aria-label="show_who_is_online"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a>';
527 $this->assertEquals($expected, $html);
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
static array $canonical_css_classes
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static array $aria_labels
test_render_with_on_load_code(string $type)
glyph_type_provider
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_dont_render_counter()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
test_render_with_unavailable_action(string $type)
glyph_type_provider
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_with_unavailable_action(string $factory_method)
glyph_type_provider
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
test_render_withCounter(string $type)
counter_type_provider
Provides common functionality for UI tests.
testTabbableGlyphRender()
test_implements_factory_interface(string $factory_method)
glyph_type_provider
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_render_with_action(string $type)
glyph_type_provider
test_glyph_no_action(string $factory_method)
glyph_type_provider
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
test_render_withTwoCounters()
normalizeHTML(string $html)
test_one_counter(string $counter_type)
counter_type_provider
test_glyph_action(string $factory_method)
glyph_type_provider
test_immutability_withCounter()
test_glyph_types(string $factory_method)
glyph_type_provider
test_render_simple(string $type)
glyph_type_provider
test_no_counter(string $factory_method)
glyph_type_provider
Test on glyph implementation.