ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ItemNotificationTest Class Reference

Test Notification Items. More...

+ Inheritance diagram for ItemNotificationTest:
+ Collaboration diagram for ItemNotificationTest:

Public Member Functions

 setUp ()
 
 getIcon ()
 
 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitle ()
 
 testGetTitleAsLink ()
 
 testWithDescription ()
 
 testWithProperties ()
 
 testWithActions ()
 
 testWithLeadIcon ()
 
 testWithCloseAction ()
 
 testWithAdditionalContent ()
 
 testWithAggregateNotifications ()
 
 testRenderFullyFeatured ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Test Notification Items.

Definition at line 13 of file ItemNotificationTest.php.

Member Function Documentation

◆ getIcon()

ItemNotificationTest::getIcon ( )

Definition at line 20 of file ItemNotificationTest.php.

21 {
22 return $this->getUIFactory()->symbol()->icon()->standard("name", "aria_label", "small", false);
23 }

References getUIFactory().

Referenced by testGetTitleAsLink(), testRenderFullyFeatured(), testWithActions(), testWithAdditionalContent(), testWithAggregateNotifications(), testWithCloseAction(), testWithDescription(), testWithLeadIcon(), and testWithProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUIFactory()

ItemNotificationTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 25 of file ItemNotificationTest.php.

26 {
27 $factory = new class extends NoUIFactory {
28 public function item()
29 {
30 return new I\Component\Item\Factory();
31 }
32 public function Link()
33 {
34 return new \ILIAS\UI\Implementation\Component\Link\Factory();
35 }
36 public function button()
37 {
38 return new I\Component\Button\Factory();
39 }
40 public function symbol() : ILIAS\UI\Component\Symbol\Factory
41 {
42 return new I\Component\Symbol\Factory(
43 new I\Component\Symbol\Icon\Factory(),
44 new I\Component\Symbol\Glyph\Factory(),
45 new I\Component\Symbol\Avatar\Factory()
46 );
47 }
48 public function mainControls() : ILIAS\UI\Component\MainControls\Factory
49 {
50 return new I\Component\MainControls\Factory(
51 $this->sig_gen,
52 new I\Component\MainControls\Slate\Factory(
53 $this->sig_gen,
54 new \ILIAS\UI\Implementation\Component\Counter\Factory(),
55 $this->symbol()
56 )
57 );
58 }
59 };
60 $factory->sig_gen = $this->sig_gen;
61 return $factory;
62 }
$factory
Definition: metadata.php:58
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $factory.

Referenced by getIcon(), testGetTitle(), testGetTitleAsLink(), testImplementsFactoryInterface(), testRenderFullyFeatured(), testWithActions(), testWithAdditionalContent(), testWithAggregateNotifications(), testWithCloseAction(), testWithDescription(), testWithLeadIcon(), and testWithProperties().

+ Here is the caller graph for this function:

◆ setUp()

ItemNotificationTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 15 of file ItemNotificationTest.php.

15 : void
16 {
17 $this->sig_gen = new I\Component\SignalGenerator();
18 }

◆ testGetTitle()

ItemNotificationTest::testGetTitle ( )

Definition at line 72 of file ItemNotificationTest.php.

73 {
74 $f = $this->getUIFactory()->item();
75 $c = $f->standard("title");
76
77 $this->assertEquals($c->getTitle(), "title");
78 }

References Vendor\Package\$c, Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetTitleAsLink()

ItemNotificationTest::testGetTitleAsLink ( )

Definition at line 80 of file ItemNotificationTest.php.

81 {
82 $f = $this->getUIFactory()->item();
83 $title_link = $this->getUIFactory()->link()->standard("TestLink", "");
84 $c = $f->standard($title_link, $this->getIcon());
85
86 $this->assertEquals($c->getTitle(), $title_link);
87 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

ItemNotificationTest::testImplementsFactoryInterface ( )

Definition at line 64 of file ItemNotificationTest.php.

65 {
66 $f = $this->getUIFactory()->item();
67
68 $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Notification", $f->notification("title", $this->getIcon()));
69 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderFullyFeatured()

ItemNotificationTest::testRenderFullyFeatured ( )

Definition at line 164 of file ItemNotificationTest.php.

165 {
166 $f = $this->getUIFactory()->item();
167 $r = $this->getDefaultRenderer(new class implements \ILIAS\UI\Implementation\Render\JavaScriptBinding {
168 public function createId()
169 {
170 return "id";
171 }
172 public $on_load_code = array();
173 public function addOnLoadCode($code)
174 {
175 $this->on_load_code[] = $code;
176 }
177 public function getOnLoadCodeAsync()
178 {
179 }
180 });
181
182 $props = array("prop1" => "val1", "prop2" => "val2");
183 $content = new I\Component\Legacy\Legacy("someContent", $this->sig_gen);
184 $actions = new I\Component\Dropdown\Standard(array(
185 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
186 new I\Component\Button\Shy("GitHub", "https://www.github.com")
187 ));
188 $title_link = $this->getUIFactory()->link()->standard("TestLink", "");
189 $aggregate = $f->notification("title_aggregate", $this->getIcon());
190
191 $c = $f->notification($title_link, $this->getIcon())
192 ->withDescription("description")
193 ->withProperties($props)
194 ->withAdditionalContent($content)
195 ->withAggregateNotifications([$aggregate])
196 ->withCloseAction("closeAction")
197 ->withActions($actions)
198 ;
199
200 $html = $this->brutallyTrimHTML($r->render($c));
201 $expected = <<<EOT
202<span class="il-item-notification-replacement-container">
203 <div class="il-item il-notification-item" id="id">
204 <div class="media">
205 <div class="media-left">
206 <div class="icon name small" aria-label="aria_label"></div>
207 </div>
208 <div class="media-body">
209 <h4 class="il-item-notification-title">
210 <a href="">TestLink</a>
211 </h4>
212 <button type="button" class="close" data-dismiss="modal" id="id">
213 <span aria-hidden="true">&times;</span>
214 <span class="sr-only">Close</span>
215 </button>
216 <div class="il-item-description">description</div>
217 <div class="dropdown">
218 <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false">
219 <span class="caret"></span>
220 </button>
221 <ul class="dropdown-menu">
222 <li>
223 <button class="btn btn-link" data-action="https://www.ilias.de" id="id">ILIAS</button>
224 </li>
225 <li>
226 <button class="btn btn-link" data-action="https://www.github.com" id="id">GitHub</button>
227 </li>
228 </ul>
229 </div>
230 <div class="il-item-additional-content">someContent</div>
231 <hr class="il-item-divider">
232 <div class="row il-item-properties">
233 <div class="col-md-12">
234 <div class="row">
235 <div class="col-sm-3 il-item-property-name">prop1</div>
236 <div class="col-sm-9 il-item-property-value il-multi-line-cap-3">val1</div>
237 </div>
238 </div>
239 <div class="col-md-12">
240 <div class="row">
241 <div class="col-sm-3 il-item-property-name">prop2</div>
242 <div class="col-sm-9 il-item-property-value il-multi-line-cap-3">val2</div>
243 </div>
244 </div>
245 </div>
246 <div class="il-aggregate-notifications" data-aggregatedby="id">
247 <div class="il-maincontrols-slate il-maincontrols-slate-notification">
248 <div class="il-maincontrols-slate-notification-title">
249 <button class="btn btn-bulky" data-action="">
250 <span class="glyph" aria-label="back">
251 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
252 </span>
253 <span class="bulky-label">back</span>
254 </button>
255 </div>
256 <div class="il-maincontrols-slate-content">
257 <span class="il-item-notification-replacement-container">
258 <div class="il-item il-notification-item" id="id">
259 <div class="media">
260 <div class="media-left">
261 <div class="icon name small" aria-label="aria_label"></div>
262 </div>
263 <div class="media-body">
264 <h4 class="il-item-notification-title">title_aggregate</h4>
265 <div class="il-aggregate-notifications" data-aggregatedby="id">
266 <div class="il-maincontrols-slate il-maincontrols-slate-notification">
267 <div class="il-maincontrols-slate-notification-title">
268 <button class="btn btn-bulky" data-action="">
269 <span class="glyph" aria-label="back">
270 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
271 </span>
272 <span class="bulky-label">back</span>
273 </button>
274 </div>
275 <div class="il-maincontrols-slate-content"></div>
276 </div>
277 </div>
278 </div>
279 </div>
280 </div>
281 </span>
282 </div>
283 </div>
284 </div>
285 </div>
286 </div>
287 </div>
288 </span>
289EOT;
290
291 $this->assertEquals($this->brutallyTrimHTML($expected), $html);
292 }
back()
Definition: back.php:2
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:346

References Vendor\Package\$c, Vendor\Package\$f, back(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithActions()

ItemNotificationTest::testWithActions ( )

Definition at line 109 of file ItemNotificationTest.php.

110 {
111 $f = $this->getUIFactory()->item();
112
113 $actions = new I\Component\Dropdown\Standard(array(
114 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
115 new I\Component\Button\Shy("GitHub", "https://www.github.com")
116 ));
117 $c = $f->notification("title", $this->getIcon())->withActions($actions);
118
119 $this->assertEquals($c->getActions(), $actions);
120 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithAdditionalContent()

ItemNotificationTest::testWithAdditionalContent ( )

Definition at line 142 of file ItemNotificationTest.php.

143 {
144 $f = $this->getUIFactory()->item();
145
146 $content = new I\Component\Legacy\Legacy("someContent", $this->sig_gen);
147 $c = $f->notification("title", $this->getIcon())->withAdditionalContent($content);
148
149 $this->assertEquals($c->getAdditionalContent(), $content);
150 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithAggregateNotifications()

ItemNotificationTest::testWithAggregateNotifications ( )

Definition at line 152 of file ItemNotificationTest.php.

153 {
154 $f = $this->getUIFactory()->item();
155
156 $aggregate = $f->notification("title_aggregate", $this->getIcon());
157 $c = $f->notification("title", $this->getIcon())
158 ->withAggregateNotifications([$aggregate,$aggregate]);
159
160
161 $this->assertEquals($c->getAggregateNotifications(), [$aggregate,$aggregate]);
162 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithCloseAction()

ItemNotificationTest::testWithCloseAction ( )

Definition at line 133 of file ItemNotificationTest.php.

134 {
135 $f = $this->getUIFactory()->item();
136
137 $c = $f->notification("title", $this->getIcon())->withCloseAction("closeAction");
138
139 $this->assertEquals($c->getCloseAction(), "closeAction");
140 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithDescription()

ItemNotificationTest::testWithDescription ( )

Definition at line 90 of file ItemNotificationTest.php.

91 {
92 $f = $this->getUIFactory()->item();
93
94 $c = $f->notification("title", $this->getIcon())->withDescription("description");
95
96 $this->assertEquals($c->getDescription(), "description");
97 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithLeadIcon()

ItemNotificationTest::testWithLeadIcon ( )

Definition at line 122 of file ItemNotificationTest.php.

123 {
124 $f = $this->getUIFactory()->item();
125
126 $c = $f->notification("title", $this->getIcon());
127 $this->assertEquals($c->getLeadIcon(), $this->getIcon());
128 $icon2 = $this->getIcon()->withIsOutlined(true);
129
130 $this->assertEquals($c->withLeadIcon($icon2)->getLeadIcon(), $icon2);
131 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithProperties()

ItemNotificationTest::testWithProperties ( )

Definition at line 99 of file ItemNotificationTest.php.

100 {
101 $f = $this->getUIFactory()->item();
102
103 $props = array("prop1" => "val1", "prop2" => "val2");
104 $c = $f->notification("title", $this->getIcon())->withProperties($props);
105
106 $this->assertEquals($c->getProperties(), $props);
107 }

References Vendor\Package\$c, Vendor\Package\$f, getIcon(), and getUIFactory().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: