5 require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../Base.php");
8 use \ILIAS\UI\Component\Link as
C;
9 use \ILIAS\UI\Implementation\Component as
I;
23 $this->factory =
new I\Link\Factory();
24 $this->glyph =
new I\Symbol\Glyph\Glyph(
"briefcase",
"briefcase");
25 $this->icon =
new I\Symbol\Icon\Standard(
"someExample",
"Example",
"small",
false);
26 $this->target = new \ILIAS\Data\URI(
"http://www.ilias.de");
31 $link = $this->factory->bulky($this->glyph,
"label", $this->target);
32 $this->assertInstanceOf(
C\Bulky::class, $link);
33 $this->assertInstanceOf(
C\Link::class, $link);
38 $this->expectException(\TypeError::class);
39 $link = $this->factory->bulky(
'wrong param',
"label", $this->target);
45 $b = $this->factory->bulky($this->glyph,
"label", $this->target)
46 ->withAriaRole(
I\
Button\Bulky::MENUITEM);
47 $this->assertEquals(
"menuitem",
$b->getAriaRole());
49 $this->assertFalse(
"This should not happen");
56 $this->factory->bulky($this->glyph,
"label", $this->target)
57 ->withAriaRole(
"loremipsum");
58 $this->assertFalse(
"This should not happen");
60 $this->assertTrue(
true);
66 $label =
'some label for the link';
67 $link = $this->factory->bulky($this->glyph, $label, $this->target);
68 $this->assertEquals($label, $link->getLabel());
73 $link = $this->factory->bulky($this->glyph,
"label", $this->target);
74 $this->assertEquals($this->glyph, $link->getSymbol());
75 $link = $this->factory->bulky($this->icon,
"label", $this->target);
76 $this->assertEquals($this->icon, $link->getSymbol());
81 $plain =
"http://www.ilias.de";
82 $with_query = $plain .
"?query1=1";
83 $with_multi_query = $with_query .
"&query2=2";
84 $with_fragment = $plain .
"#fragment";
85 $with_multi_query_and_fragment_uri = $with_multi_query . $with_fragment;
87 $plain_uri = new \ILIAS\Data\URI($plain);
88 $with_query_uri = new \ILIAS\Data\URI($with_query);
89 $with_multi_query_uri = new \ILIAS\Data\URI($with_multi_query);
90 $with_fragment_uri = new \ILIAS\Data\URI($with_fragment);
91 $with_multi_query_and_fragment_uri = new \ILIAS\Data\URI($with_multi_query_and_fragment_uri);
93 $this->assertEquals($plain, $this->factory->bulky($this->glyph,
"label", $plain_uri)->getAction());
94 $this->assertEquals($with_query, $this->factory->bulky($this->glyph,
"label", $with_query_uri)->getAction());
95 $this->assertEquals($with_multi_query, $this->factory->bulky($this->glyph,
"label", $with_multi_query_uri)->getAction());
96 $this->assertEquals($with_fragment_uri, $this->factory->bulky($this->glyph,
"label", $with_fragment_uri)->getAction());
97 $this->assertEquals($with_multi_query_and_fragment_uri, $this->factory->bulky($this->glyph,
"label", $with_multi_query_and_fragment_uri)->getAction());
103 $b = $this->factory->bulky($this->glyph,
"label", $this->target);
106 .
'<a class="il-link link-bulky" href="http://www.ilias.de">' 107 .
' <span class="glyph" aria-label="briefcase" role="img">' 108 .
' <span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>' 110 .
' <span class="bulky-label">label</span>' 122 $b = $this->factory->bulky($this->icon,
"label", $this->target);
125 .
'<a class="il-link link-bulky" href="http://www.ilias.de">' 126 .
' <img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt="Example"/>' 127 .
' <span class="bulky-label">label</span>' 138 $b = $this->factory->bulky($this->icon,
"label", $this->target)
139 ->withAdditionalOnloadCode(
function ($id) {
144 .
'<a class="il-link link-bulky" href="http://www.ilias.de" id="id_1">' 145 .
'<img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt="Example"/>' 146 .
' <span class="bulky-label">label</span>' 158 $b = $this->factory->bulky($this->icon,
"label", $this->target)
159 ->withAriaRole(
I\
Button\Bulky::MENUITEM);
162 .
'<a class="il-link link-bulky" href="http://www.ilias.de" role="menuitem">' 163 .
'<img class="icon someExample small" src="./templates/default/images/icon_default.svg" alt="Example"/>' 164 .
' <span class="bulky-label">label</span>'
Testing behavior of the Bulky Link.
Provides common functionality for UI tests.
testRenderWithAriaRoleMenuitem()
assertHTMLEquals($expected_html_as_string, $html_as_string)
testWithAriaRoleIncorrect()
testImplementsInterfaces()
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])