ILIAS  release_8 Revision v8.24
NotificationSlateTest Class Reference

Tests for the Slate. More...

+ Inheritance diagram for NotificationSlateTest:
+ Collaboration diagram for NotificationSlateTest:

Public Member Functions

 setUp ()
 
 getIcon ()
 
 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGenerationByFactory ()
 
 testRenderingWithSubslateAndButton ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Attributes

I SignalGenerator $sig_gen
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Tests for the Slate.

Definition at line 31 of file NotificationSlateTest.php.

Member Function Documentation

◆ getIcon()

NotificationSlateTest::getIcon ( )

Definition at line 40 of file NotificationSlateTest.php.

41 {
42 return $this->getUIFactory()->symbol()->icon()->standard("name", "aria_label", "small", false);
43 }

References getUIFactory().

Referenced by testGenerationByFactory(), and testRenderingWithSubslateAndButton().

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

◆ getUIFactory()

NotificationSlateTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 45 of file NotificationSlateTest.php.

46 {
47 $factory = new class () extends NoUIFactory {
49
50 public function button(): C\Button\Factory
51 {
52 return new I\Button\Factory();
53 }
54 public function symbol(): ILIAS\UI\Component\Symbol\Factory
55 {
56 return new I\Symbol\Factory(
57 new I\Symbol\Icon\Factory(),
58 new I\Symbol\Glyph\Factory(),
59 new I\Symbol\Avatar\Factory()
60 );
61 }
62 public function item(): C\Item\Factory
63 {
64 return new I\Item\Factory();
65 }
66 public function mainControls(): C\MainControls\Factory
67 {
68 return new I\MainControls\Factory(
69 $this->sig_gen,
70 new I\MainControls\Slate\Factory(
71 $this->sig_gen,
72 new Factory(),
73 $this->symbol()
74 )
75 );
76 }
77 public function icon(): C\Symbol\Icon\Factory
78 {
79 return new I\Symbol\Icon\Factory();
80 }
81 };
82 $factory->sig_gen = $this->sig_gen;
83
84 return $factory;
85 }
$factory
Definition: metadata.php:75
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $factory, and $sig_gen.

Referenced by getIcon(), testGenerationByFactory(), testImplementsFactoryInterface(), and testRenderingWithSubslateAndButton().

+ Here is the caller graph for this function:

◆ setUp()

NotificationSlateTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 35 of file NotificationSlateTest.php.

35 : void
36 {
37 $this->sig_gen = new I\SignalGenerator();
38 }

◆ testGenerationByFactory()

NotificationSlateTest::testGenerationByFactory ( )

Definition at line 94 of file NotificationSlateTest.php.

94 : void
95 {
96 $item = $this->getUIFactory()->item()->notification("title", $this->getIcon())
97 ->withDescription("description");
98
99 $notification_slate = $this->getUIFactory()->mainControls()->slate()->notification("title", [$item,$item]);
100 $this->assertEquals("title", $notification_slate->getName());
101 $this->assertEquals($notification_slate->getContents(), [$item,$item]);
102 }

References getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

NotificationSlateTest::testImplementsFactoryInterface ( )

Definition at line 87 of file NotificationSlateTest.php.

87 : void
88 {
89 $notificatino_slate = $this->getUIFactory()->mainControls()->slate()->notification("title", []);
90
91 $this->assertInstanceOf("ILIAS\\UI\\Component\\MainControls\\Slate\\Notification", $notificatino_slate);
92 }

References getUIFactory().

+ Here is the call graph for this function:

◆ testRenderingWithSubslateAndButton()

NotificationSlateTest::testRenderingWithSubslateAndButton ( )

Definition at line 116 of file NotificationSlateTest.php.

116 : void
117 {
118 $item = $this->getUIFactory()->item()->notification("item title", $this->getIcon());
119 $notification_slate = $this->getUIFactory()->mainControls()->slate()->notification("slate title", [$item]);
120
121
122 $r = $this->getDefaultRenderer();
123 $html = $r->render($notification_slate);
124
125 $expected = <<<EOT
126<div class="il-maincontrols-slate il-maincontrols-slate-notification">
127 <div class="il-maincontrols-slate-notification-title">slate title</div>
128 <div class="il-maincontrols-slate-content">
129 <div class="il-item-notification-replacement-container">
130 <div class="il-item il-notification-item" id="id_1">
131 <div class="media">
132 <div class="media-left">
133 <img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label"/>
134 </div>
135 <div class="media-body">
136 <h4 class="il-item-notification-title">item title</h4>
137 <div class="il-aggregate-notifications" data-aggregatedby="id_1">
138 <div class="il-maincontrols-slate il-maincontrols-slate-notification">
139 <div class="il-maincontrols-slate-notification-title">
140 <button class="btn btn-bulky" data-action="">
141 <span class="glyph" role="img">
142 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
143 </span>
144 <span class="bulky-label">back</span>
145 </button>
146 </div>
147 <div class="il-maincontrols-slate-content"></div>
148 </div>
149 </div>
150 </div>
151 </div>
152 </div>
153 </div>
154 </div>
155</div>
156EOT;
157 $this->assertEquals(
158 $this->brutallyTrimHTML($expected),
159 $this->brutallyTrimHTML($html)
160 );
161 }
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getIcon(), and getUIFactory().

+ Here is the call graph for this function:

Field Documentation

◆ $sig_gen

I SignalGenerator NotificationSlateTest::$sig_gen
protected

Definition at line 33 of file NotificationSlateTest.php.

Referenced by getUIFactory().


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