ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getImagePathResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 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.

References getUIFactory().

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

21  {
22  return $this->getUIFactory()->symbol()->icon()->standard("name", "aria_label", "small", false);
23  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUIFactory()

ItemNotificationTest::getUIFactory ( )

Definition at line 25 of file ItemNotificationTest.php.

References $factory.

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

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  }
Class Factory.
Class ChatMainBarProvider .
$factory
Definition: metadata.php:58
+ Here is the caller graph for this function:

◆ setUp()

ItemNotificationTest::setUp ( )

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.

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

73  {
74  $f = $this->getUIFactory()->item();
75  $c = $f->standard("title");
76 
77  $this->assertEquals($c->getTitle(), "title");
78  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testGetTitleAsLink()

ItemNotificationTest::testGetTitleAsLink ( )

Definition at line 80 of file ItemNotificationTest.php.

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

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  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

ItemNotificationTest::testImplementsFactoryInterface ( )

Definition at line 64 of file ItemNotificationTest.php.

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

65  {
66  $f = $this->getUIFactory()->item();
67 
68  $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Notification", $f->notification("title", $this->getIcon()));
69  }
+ Here is the call graph for this function:

◆ testRenderFullyFeatured()

ItemNotificationTest::testRenderFullyFeatured ( )

Definition at line 164 of file ItemNotificationTest.php.

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

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 <div 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  <img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label"/>
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" aria-label="close" id="id">
213  <span aria-hidden="true">&times;</span>
214  </button>
215  <div class="il-item-description">description</div>
216  <div class="dropdown">
217  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false">
218  <span class="caret"></span>
219  </button>
220  <ul class="dropdown-menu">
221  <li>
222  <button class="btn btn-link" data-action="https://www.ilias.de" id="id">ILIAS</button>
223  </li>
224  <li>
225  <button class="btn btn-link" data-action="https://www.github.com" id="id">GitHub</button>
226  </li>
227  </ul>
228  </div>
229  <div class="il-item-additional-content">someContent</div>
230  <hr class="il-item-divider">
231  <div class="row il-item-properties">
232  <div class="col-sm-12 il-multi-line-cap-3">
233  <span class="il-item-property-name">prop1</span><span class="il-item-property-value">val1</span>
234  </div>
235  <div class="col-sm-12 il-multi-line-cap-3">
236  <span class="il-item-property-name">prop2</span><span class="il-item-property-value">val2</span>
237  </div>
238  </div>
239  <div class="il-aggregate-notifications" data-aggregatedby="id">
240  <div class="il-maincontrols-slate il-maincontrols-slate-notification">
241  <div class="il-maincontrols-slate-notification-title">
242  <button class="btn btn-bulky" data-action="">
243  <span class="glyph" aria-label="back" role="img">
244  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
245  </span>
246  <span class="bulky-label">back</span>
247  </button>
248  </div>
249  <div class="il-maincontrols-slate-content">
250  <div class="il-item-notification-replacement-container">
251  <div class="il-item il-notification-item" id="id">
252  <div class="media">
253  <div class="media-left">
254  <img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label"/>
255  </div>
256  <div class="media-body">
257  <h4 class="il-item-notification-title">title_aggregate</h4>
258  <div class="il-aggregate-notifications" data-aggregatedby="id">
259  <div class="il-maincontrols-slate il-maincontrols-slate-notification">
260  <div class="il-maincontrols-slate-notification-title">
261  <button class="btn btn-bulky" data-action="">
262  <span class="glyph" aria-label="back" role="img">
263  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
264  </span>
265  <span class="bulky-label">back</span>
266  </button>
267  </div>
268  <div class="il-maincontrols-slate-content"></div>
269  </div>
270  </div>
271  </div>
272  </div>
273  </div>
274  </div>
275  </div>
276  </div>
277  </div>
278  </div>
279  </div>
280  </div>
281  </div>
282 EOT;
283 
284  $this->assertEquals($this->brutallyTrimHTML($expected), $html);
285  }
Class Factory.
$c
Definition: cli.php:37
Class ChatMainBarProvider .
back()
Definition: back.php:2
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

◆ testWithActions()

ItemNotificationTest::testWithActions ( )

Definition at line 109 of file ItemNotificationTest.php.

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

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  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testWithAdditionalContent()

ItemNotificationTest::testWithAdditionalContent ( )

Definition at line 142 of file ItemNotificationTest.php.

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

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  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testWithAggregateNotifications()

ItemNotificationTest::testWithAggregateNotifications ( )

Definition at line 152 of file ItemNotificationTest.php.

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

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  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testWithCloseAction()

ItemNotificationTest::testWithCloseAction ( )

Definition at line 133 of file ItemNotificationTest.php.

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

134  {
135  $f = $this->getUIFactory()->item();
136 
137  $c = $f->notification("title", $this->getIcon())->withCloseAction("closeAction");
138 
139  $this->assertEquals($c->getCloseAction(), "closeAction");
140  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testWithDescription()

ItemNotificationTest::testWithDescription ( )

Definition at line 90 of file ItemNotificationTest.php.

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

91  {
92  $f = $this->getUIFactory()->item();
93 
94  $c = $f->notification("title", $this->getIcon())->withDescription("description");
95 
96  $this->assertEquals($c->getDescription(), "description");
97  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testWithLeadIcon()

ItemNotificationTest::testWithLeadIcon ( )

Definition at line 122 of file ItemNotificationTest.php.

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

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  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ testWithProperties()

ItemNotificationTest::testWithProperties ( )

Definition at line 99 of file ItemNotificationTest.php.

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

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  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

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