4 require_once(
"libs/composer/vendor/autoload.php");
5 require_once(__DIR__ .
"/../../Base.php");
7 use \ILIAS\UI\Component as
C;
8 use \ILIAS\UI\Implementation as
I;
17 return new I\Component\Icon\Factory();
23 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Icon\\Factory",
$f);
25 $si =
$f->standard(
'course',
'Kurs');
26 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Icon\\Standard",
$si);
28 $ci =
$f->custom(
'course',
'Kurs');
29 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Icon\\Custom", $ci);
36 $ico =
$f->standard(
'course',
'Kurs');
37 $this->assertEquals(
'Kurs', $ico->getAriaLabel());
38 $this->assertEquals(
'course', $ico->getName());
39 $this->assertEquals(
'small', $ico->getSize());
40 $this->assertEquals(
false, $ico->isDisabled());
41 $this->assertEquals(
false, $ico->isOutlined());
43 $this->assertNull($ico->getAbbreviation());
45 $ico = $ico->withAbbreviation(
'K');
46 $this->assertEquals(
'K', $ico->getAbbreviation());
52 $ico =
$f->standard(
'course',
'Kurs');
54 $ico = $ico->withSize(
'medium');
55 $this->assertEquals(
'medium', $ico->getSize());
57 $ico = $ico->withSize(
'large');
58 $this->assertEquals(
'large', $ico->getSize());
60 $ico = $ico->withSize(
'small');
61 $this->assertEquals(
'small', $ico->getSize());
68 $ico =
$f->standard(
'course',
'Kurs');
69 $ico = $ico->withSize(
'tiny');
70 $this->assertFalse(
"This should not happen");
72 $this->assertTrue(
true);
79 $ico =
$f->standard(
'course',
'Kurs',
'small');
81 $ico = $ico->withDisabled(
false);
82 $this->assertEquals(
false, $ico->isDisabled());
84 $ico = $ico->withDisabled(
true);
85 $this->assertEquals(
true, $ico->isDisabled());
92 $ico =
$f->standard(
'course',
'Kurs',
'small');
93 $ico = $ico->withDisabled(
'true');
94 $this->assertFalse(
"This should not happen");
96 $this->assertTrue(
true);
103 $ico =
$f->standard(
'course',
'Kurs',
'small');
105 $ico = $ico->withIsOutlined(
true);
106 $this->assertEquals(
true, $ico->isOutlined());
108 $ico = $ico->withIsOutlined(
false);
109 $this->assertEquals(
false, $ico->isOutlined());
116 $ico =
$f->custom(
'/some/path/',
'Custom Icon');
117 $this->assertEquals(
'/some/path/', $ico->getIconPath());
125 $ico = $ico =
$f->standard(
'crs',
'Course',
'medium');
127 $expected =
'<div class="icon crs medium" aria-label="Course"></div>';
128 $this->assertEquals($expected,
$html);
131 $ico = $ico->withDisabled(
true);
133 $expected =
'<div class="icon crs medium disabled" aria-label="Course"></div>';
134 $this->assertEquals($expected,
$html);
137 $ico = $ico->withAbbreviation(
'CRS');
139 $expected =
'<div class="icon crs medium disabled" aria-label="Course">' 140 .
' <div class="abbreviation">CRS</div>' 142 $this->assertEquals($expected,
$html);
150 $ico = $ico =
$f->standard(
'crs',
'Course',
'medium')->withIsOutlined(
true);
152 $expected =
'<div class="icon crs medium outlined" aria-label="Course"></div>';
153 $this->assertEquals($expected,
$html);
156 $ico = $ico->withDisabled(
true);
158 $expected =
'<div class="icon crs medium disabled outlined" aria-label="Course"></div>';
159 $this->assertEquals($expected,
$html);
162 $ico = $ico->withAbbreviation(
'CRS');
164 $expected =
'<div class="icon crs medium disabled outlined" aria-label="Course">' 165 .
' <div class="abbreviation">CRS</div>' 167 $this->assertEquals($expected,
$html);
174 $path =
'./templates/default/images/icon_fold.svg';
176 $ico = $ico =
$f->custom(
$path,
'Custom',
'medium');
178 $expected =
'<div class="icon custom medium" aria-label="Custom">' 179 .
' <img src="./templates/default/images/icon_fold.svg" />' 181 $this->assertEquals($expected,
$html);
184 $ico = $ico->withDisabled(
true);
186 $expected =
'<div class="icon custom medium disabled" aria-label="Custom">' 187 .
' <img src="./templates/default/images/icon_fold.svg" />' 189 $this->assertEquals($expected,
$html);
192 $ico = $ico->withAbbreviation(
'CS');
194 $expected =
'<div class="icon custom medium disabled" aria-label="Custom">' 195 .
' <img src="./templates/default/images/icon_fold.svg" />' 196 .
' <div class="abbreviation">CS</div>' 199 $this->assertEquals($expected,
$html);
testDisabledModificationWrongParam()
testDisabledModification()
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Provides common functionality for UI tests.
testSizeModificationWrongParam()
testOutlinedModification()
Test on icon implementation.
testRenderingStandardOutlined()