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

Tests for the Slate. More...

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

Public Member Functions

 setUp ()
 
 getIcon ()
 
 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGenerationByFactory ()
 
 testWithAdditionalEntry ()
 
 testRenderingWithSubslateAndButton ()
 
- 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

Tests for the Slate.

Definition at line 15 of file NotificationSlateTest.php.

Member Function Documentation

◆ getIcon()

NotificationSlateTest::getIcon ( )

Definition at line 22 of file NotificationSlateTest.php.

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

References getUIFactory().

Referenced by testGenerationByFactory(), testRenderingWithSubslateAndButton(), and testWithAdditionalEntry().

+ 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 27 of file NotificationSlateTest.php.

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

References $factory.

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

+ Here is the caller graph for this function:

◆ setUp()

NotificationSlateTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 17 of file NotificationSlateTest.php.

17 : void
18 {
19 $this->sig_gen = new I\SignalGenerator();
20 }

◆ testGenerationByFactory()

NotificationSlateTest::testGenerationByFactory ( )

Definition at line 74 of file NotificationSlateTest.php.

75 {
76 $item = $this->getUIFactory()->item()->notification("title", $this->getIcon())
77 ->withDescription("description");
78
79 $notification_slate = $this->getUIFactory()->mainControls()->slate()->notification("title", [$item,$item]);
80 $this->assertEquals($notification_slate->getName(), "title");
81 $this->assertEquals($notification_slate->getContents(), [$item,$item]);
82 }

References getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

NotificationSlateTest::testImplementsFactoryInterface ( )

Definition at line 67 of file NotificationSlateTest.php.

68 {
69 $notificatino_slate = $this->getUIFactory()->mainControls()->slate()->notification("title", []);
70
71 $this->assertInstanceOf("ILIAS\\UI\\Component\\MainControls\\Slate\\Notification", $notificatino_slate);
72 }

References getUIFactory().

+ Here is the call graph for this function:

◆ testRenderingWithSubslateAndButton()

NotificationSlateTest::testRenderingWithSubslateAndButton ( )

Definition at line 95 of file NotificationSlateTest.php.

96 {
97 $item = $this->getUIFactory()->item()->notification("item title", $this->getIcon());
98 $notification_slate = $this->getUIFactory()->mainControls()->slate()->notification("slate title", [$item]);
99
100
101 $r = $this->getDefaultRenderer();
102 $html = $r->render($notification_slate);
103
104 $expected = <<<EOT
105<div class="il-maincontrols-slate il-maincontrols-slate-notification">
106 <div class="il-maincontrols-slate-notification-title">slate title</div>
107 <div class="il-maincontrols-slate-content">
108 <span class="il-item-notification-replacement-container">
109 <div class="il-item il-notification-item" id="id_1">
110 <div class="media">
111 <div class="media-left">
112 <div class="icon name small" aria-label="aria_label"></div>
113 </div>
114 <div class="media-body">
115 <h4 class="il-item-notification-title">item title</h4>
116 <div class="il-aggregate-notifications" data-aggregatedby="id_1">
117 <div class="il-maincontrols-slate il-maincontrols-slate-notification">
118 <div class="il-maincontrols-slate-notification-title">
119 <button class="btn btn-bulky" data-action="">
120 <span class="glyph" aria-label="back">
121 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
122 </span>
123 <span class="bulky-label">back</span>
124 </button>
125 </div>
126 <div class="il-maincontrols-slate-content"></div>
127 </div>
128 </div>
129 </div>
130 </div>
131 </div>
132 </span>
133 </div>
134</div>
135EOT;
136 $this->assertEquals(
137 $this->brutallyTrimHTML($expected),
138 $this->brutallyTrimHTML($html)
139 );
140 }
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 back(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getIcon(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithAdditionalEntry()

NotificationSlateTest::testWithAdditionalEntry ( )

Definition at line 85 of file NotificationSlateTest.php.

86 {
87 $item = $this->getUIFactory()->item()->notification("title", $this->getIcon())
88 ->withDescription("description");
89 $notification_slate = $this->getUIFactory()->mainControls()->slate()->notification("title", [$item,$item]);
90 $this->assertEquals($notification_slate->getContents(), [$item,$item]);
91 $notification_slate = $notification_slate->withAdditionalEntry($item);
92 $this->assertEquals($notification_slate->getContents(), [$item,$item,$item]);
93 }

References getIcon(), and getUIFactory().

+ Here is the call graph for this function:

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