ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 

Protected Attributes

I SignalGenerator $sig_gen
 

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 ( )

Definition at line 45 of file NotificationSlateTest.php.

46 {
47 $factory = new class () extends NoUIFactory {
48 public I\SignalGenerator $sig_gen;
49
50 public function button(): I\Button\Factory
51 {
52 return new I\Button\Factory();
53 }
54 public function symbol(): I\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(): I\Item\Factory
63 {
64 return new I\Item\Factory();
65 }
66 public function mainControls(): I\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 }
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

References $sig_gen, ILIAS\Repository\button(), and ILIAS\Repository\symbol().

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

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

◆ setUp()

NotificationSlateTest::setUp ( )

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="./assets/images/standard/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 }

References ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\button(), 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: