19 declare(strict_types=1);
21 require_once(
"libs/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
39 return new I\Symbol\Glyph\Factory();
44 return new I\Counter\Factory();
48 G\Glyph::SETTINGS =>
"glyphicon glyphicon-cog",
49 G\Glyph::EXPAND =>
"glyphicon glyphicon-triangle-right",
50 G\Glyph::COLLAPSE =>
"glyphicon glyphicon-triangle-bottom",
51 G\Glyph::ADD =>
"glyphicon glyphicon-plus-sign",
52 G\Glyph::REMOVE =>
"glyphicon glyphicon-minus-sign",
53 G\Glyph::UP =>
"glyphicon glyphicon-circle-arrow-up",
54 G\Glyph::DOWN =>
"glyphicon glyphicon-circle-arrow-down",
55 G\Glyph::BACK =>
"glyphicon glyphicon-chevron-left",
56 G\Glyph::NEXT =>
"glyphicon glyphicon-chevron-right",
57 G\Glyph::SORT_ASCENDING =>
"glyphicon glyphicon-arrow-up",
58 G\Glyph::SORT_DESCENDING =>
"glyphicon glyphicon-arrow-down",
59 G\Glyph::USER =>
"glyphicon glyphicon-user",
60 G\Glyph::MAIL =>
"glyphicon glyphicon-envelope",
61 G\Glyph::NOTIFICATION =>
"glyphicon glyphicon-bell",
63 G\Glyph::NOTE =>
"glyphicon glyphicon-pushpin",
64 G\Glyph::COMMENT =>
"glyphicon glyphicon-comment",
65 G\Glyph::BRIEFCASE =>
"glyphicon glyphicon-briefcase",
66 G\Glyph::LIKE =>
"glyphicon il-glyphicon-like",
67 G\Glyph::LOVE =>
"glyphicon il-glyphicon-love",
68 G\Glyph::DISLIKE =>
"glyphicon il-glyphicon-dislike",
69 G\Glyph::LAUGH =>
"glyphicon il-glyphicon-laugh",
70 G\Glyph::ASTOUNDED =>
"glyphicon il-glyphicon-astounded",
71 G\Glyph::SAD =>
"glyphicon il-glyphicon-sad",
72 G\Glyph::ANGRY =>
"glyphicon il-glyphicon-angry",
73 G\Glyph::EYEOPEN =>
"glyphicon glyphicon-eye-open",
74 G\Glyph::EYECLOSED =>
"glyphicon glyphicon-eye-close",
75 G\Glyph::ATTACHMENT =>
"glyphicon glyphicon-paperclip",
76 G\Glyph::RESET =>
"glyphicon glyphicon-reset",
77 G\Glyph::APPLY =>
"glyphicon glyphicon-apply",
78 G\Glyph::SEARCH =>
"glyphicon glyphicon-search",
79 G\Glyph::HELP =>
"glyphicon glyphicon-question-sign",
80 G\Glyph::CALENDAR =>
"glyphicon glyphicon-calendar",
81 G\Glyph::TIME =>
"glyphicon glyphicon-time",
82 G\Glyph::CLOSE =>
"glyphicon glyphicon-remove",
83 G\Glyph::MORE =>
"glyphicon glyphicon-option-horizontal",
84 G\Glyph::DISCLOSURE =>
"glyphicon glyphicon-option-vertical",
85 G\Glyph::LANGUAGE =>
"glyphicon glyphicon-lang",
86 G\Glyph::LOGIN =>
"glyphicon glyphicon-login",
87 G\Glyph::LOGOUT =>
"glyphicon glyphicon-logout",
88 G\Glyph::BULLETLIST =>
"glyphicon glyphicon-bulletlist",
89 G\Glyph::NUMBEREDLIST =>
"glyphicon glyphicon-numberedlist",
90 G\Glyph::LISTINDENT =>
"glyphicon glyphicon-listindent",
91 G\Glyph::LISTOUTDENT =>
"glyphicon glyphicon-listoutdent",
92 G\Glyph::FILTER =>
"glyphicon glyphicon-filter",
93 G\Glyph::COLLAPSE_HORIZONTAL =>
"glyphicon glyphicon-triangle-left",
94 G\Glyph::HEADER =>
"glyphicon glyphicon-header",
95 G\Glyph::ITALIC =>
"glyphicon glyphicon-italic",
96 G\Glyph::BOLD =>
"glyphicon glyphicon-bold",
97 G\Glyph::LINK =>
"glyphicon glyphicon-link",
98 G\Glyph::LAUNCH =>
"glyphicon glyphicon-launch" 102 G\Glyph::SETTINGS =>
"settings",
103 G\Glyph::EXPAND =>
"expand_content",
104 G\Glyph::COLLAPSE =>
"collapse_content",
105 G\Glyph::ADD =>
"add",
106 G\Glyph::REMOVE =>
"remove",
108 G\Glyph::DOWN =>
"down",
109 G\Glyph::BACK =>
"back",
110 G\Glyph::NEXT =>
"next",
111 G\Glyph::SORT_ASCENDING =>
"sort_ascending",
112 G\Glyph::SORT_DESCENDING =>
"sort_descending",
113 G\Glyph::USER =>
"show_who_is_online",
114 G\Glyph::MAIL =>
"mail",
115 G\Glyph::NOTIFICATION =>
"notifications",
117 G\Glyph::NOTE =>
"notes",
118 G\Glyph::COMMENT =>
"comments",
119 G\Glyph::BRIEFCASE =>
"briefcase",
120 G\Glyph::LIKE =>
"like",
121 G\Glyph::LOVE =>
"love",
122 G\Glyph::DISLIKE =>
"dislike",
123 G\Glyph::LAUGH =>
"laugh",
124 G\Glyph::ASTOUNDED =>
"astounded",
125 G\Glyph::SAD =>
"sad",
126 G\Glyph::ANGRY =>
"angry",
127 G\Glyph::EYEOPEN =>
"eyeopened",
128 G\Glyph::EYECLOSED =>
"eyeclosed",
129 G\Glyph::ATTACHMENT =>
"attachment",
130 G\Glyph::RESET =>
"reset",
131 G\Glyph::APPLY =>
"apply",
132 G\Glyph::SEARCH =>
"search",
133 G\Glyph::HELP =>
"help",
134 G\Glyph::CALENDAR =>
"calendar",
135 G\Glyph::TIME =>
"time",
136 G\Glyph::CLOSE =>
"close",
137 G\Glyph::MORE =>
"show_more",
138 G\Glyph::DISCLOSURE =>
"disclose",
139 G\Glyph::LANGUAGE =>
"switch_language",
140 G\Glyph::LOGIN =>
"log_in",
141 G\Glyph::LOGOUT =>
"log_out",
142 G\Glyph::BULLETLIST =>
"bulletlist_action",
143 G\Glyph::NUMBEREDLIST =>
"numberedlist_action",
144 G\Glyph::LISTINDENT =>
"listindent",
145 G\Glyph::LISTOUTDENT =>
"listoutdent",
146 G\Glyph::FILTER =>
"filter",
147 G\Glyph::COLLAPSE_HORIZONTAL =>
"collapse/back",
148 G\Glyph::HEADER =>
"header_action",
149 G\Glyph::ITALIC =>
"italic_action",
150 G\Glyph::BOLD =>
"bold_action",
151 G\Glyph::LINK =>
"link_action",
152 G\Glyph::LAUNCH =>
"launch" 162 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Glyph\\Factory",
$f);
163 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Glyph\\Glyph",
$f->$factory_method(
"http://www.ilias.de"));
172 $g =
$f->$factory_method();
174 $this->assertNotNull($g);
175 $this->assertEquals($factory_method, $g->getType());
184 $g =
$f->$factory_method(
"http://www.ilias.de");
186 $this->assertNotNull($g);
187 $this->assertEquals(
"http://www.ilias.de", $g->getAction());
196 $g =
$f->$factory_method();
198 $this->assertNotNull($g);
199 $this->assertEquals(null, $g->getAction());
208 $g =
$f->$factory_method();
209 $g2 =
$f->$factory_method()->withUnavailableAction();
211 $this->assertTrue($g->isActive());
212 $this->assertFalse($g2->isActive());
220 $g2 = $g->withHighlight();
222 $this->assertFalse($g->isHighlighted());
223 $this->assertTrue($g2->isHighlighted());
232 $g =
$f->$factory_method();
234 $this->assertCount(0, $g->getCounters());
249 $cf->$counter_type($number)
252 $counters = $g->getCounters();
253 $this->assertCount(1, $counters);
255 $this->assertEquals($counter_type,
$c->getType());
256 $this->assertEquals($number,
$c->getNumber());
269 $cf->status($number_s)
272 $cf->novelty($number_n)
275 $counters = $g->getCounters();
276 $this->assertCount(2, $counters);
277 $vals = array_map(
function (
$c) {
278 return array(
$c->getType(),
$c->getNumber());
280 $this->assertContains(array(
"status", $number_s), $vals);
281 $this->assertContains(array(
"novelty", $number_n), $vals);
295 $cf->status($number_s)
298 $cf->novelty($number_n1)
301 $cf->novelty($number_n2)
304 $counters = $g->getCounters();
305 $this->assertCount(2, $counters);
306 $vals = array_map(
function (
$c) {
307 return array(
$c->getType(),
$c->getNumber());
309 $this->assertContains(array(
"status", $number_s), $vals);
310 $this->assertContains(array(
"novelty", $number_n2), $vals);
324 $counters = $g->getCounters();
325 $this->assertCount(0, $counters);
330 $this->expectException(InvalidArgumentException::class);
331 new Glyph(
"FOO",
"http://www.ilias.de");
337 $constant_values = array_values($glyph_reflection->getConstants());
338 return array_map(
function ($val) {
340 }, $constant_values);
358 $c =
$f->$type(
"http://www.ilias.de");
362 $css_classes = self::$canonical_css_classes[$type];
363 $aria_label = self::$aria_labels[$type];
365 $expected =
'<a tabindex="0" class="glyph" href="http://www.ilias.de" aria-label="' . $aria_label .
'"><span class="' . $css_classes .
'" aria-hidden="true"></span></a>';
366 $this->assertEquals($expected, $html);
376 $c =
$f->$type(
"http://www.ilias.de")->withUnavailableAction();
380 $css_classes = self::$canonical_css_classes[$type];
381 $aria_label = self::$aria_labels[$type];
384 <a class="glyph disabled" aria-label="' . $aria_label .
'" aria-disabled="true"> 385 <span class="' . $css_classes .
'" aria-hidden="true"></span> 398 $c = $fg->mail(
"http://www.ilias.de")->withCounter($fc->$type(42));
406 <a tabindex="0" class="glyph" href="http://www.ilias.de" aria-label="' . $aria_label .
'"> 407 <span class="' . $css_classes .
'" aria-hidden="true"></span> 408 <span class="il-counter"><span class="badge badge-notify il-counter-' . $type .
'">42</span></span> 409 <span class="il-counter-spacer">42</span> 419 $c = $fg->mail(
"http://www.ilias.de")
420 ->withCounter($fc->novelty(42))
421 ->withCounter($fc->status(7));
427 $expected =
"<a tabindex=\"0\" class=\"glyph\" href=\"http://www.ilias.de\" aria-label=\"$aria_label\">" .
428 "<span class=\"$css_classes\" aria-hidden=\"true\"></span>" .
429 "<span class=\"il-counter\"><span class=\"badge badge-notify il-counter-status\">7</span></span>" .
430 "<span class=\"il-counter\"><span class=\"badge badge-notify il-counter-novelty\">42</span></span>" .
431 "<span class=\"il-counter-spacer\">42</span>" .
438 $this->expectException(LogicException::class);
446 $this->createMock(DataFactory::class),
447 $this->createMock(HelpTextRetriever::class),
463 $c =
$f->$type(
"http://www.ilias.de")
464 ->withOnLoadCode(
function (
$id) use (&$ids):
string {
471 $this->assertCount(1, $ids);
473 $css_classes = self::$canonical_css_classes[$type];
474 $aria_label = self::$aria_labels[$type];
477 $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>";
478 $this->assertEquals($expected, $html);
488 $c =
$f->$type(
"http://www.ilias.de");
489 $c =
$c->withAction(
"http://www.ilias.de/open-source-lms-ilias/");
493 $css_classes = self::$canonical_css_classes[$type];
494 $aria_label = self::$aria_labels[$type];
496 $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>";
497 $this->assertEquals($expected, $html);
507 $this->assertFalse(
$c->isTabbable());
510 $c =
$f->user()->withAction(
"#");
511 $this->assertTrue($c->isTabbable());
514 $c =
$f->user()->withOnClick(
new I\
Signal(
"id_1",
"click"));
515 $this->assertTrue($c->isTabbable());
518 $c =
$f->user()->withAction(
"#")->withOnClick(
new I\
Signal(
"id_1",
"click"));
519 $this->assertTrue($c->isTabbable());
522 $c =
$f->user()->withAction(
"#")->withOnClick(
new I\
Signal(
"id_1",
"click"))->withUnavailableAction();
523 $this->assertFalse($c->isTabbable());
533 $expected =
'<a class="glyph" aria-label="show_who_is_online"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a>';
535 $this->assertEquals($expected, $html);
538 $c =
$f->user()->withAction(
"#");
539 $expected =
'<a tabindex="0" class="glyph" href="#" aria-label="show_who_is_online"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a>';
541 $this->assertEquals($expected, $html);
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
static array $canonical_css_classes
testOneCounter(string $counter_type)
getCounterTypeProvider
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static array $aria_labels
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testRenderWithTwoCounters()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testRenderWithCounter(string $type)
getCounterTypeProvider
testGlyphTypes(string $factory_method)
getGlyphTypeProvider
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
testImmutabilityWithCounter()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testRenderWithAction(string $type)
getGlyphTypeProvider
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
testGlyphAction(string $factory_method)
getGlyphTypeProvider
Provides common functionality for UI tests.
testTabbableGlyphRender()
testRenderWithOnLoadCode(string $type)
getGlyphTypeProvider
testRenderSimple(string $type)
getGlyphTypeProvider
testImplementsFactoryInterface(string $factory_method)
getGlyphTypeProvider
testWithUnavailableAction(string $factory_method)
getGlyphTypeProvider
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
testRenderWithUnavailableAction(string $type)
getGlyphTypeProvider
testGlyphNoAction(string $factory_method)
getGlyphTypeProvider
testNoCounter(string $factory_method)
getGlyphTypeProvider
normalizeHTML(string $html)
Test on glyph implementation.