ILIAS  release_8 Revision v8.24
CombinedSlateTest Class Reference

Tests for the Slate. More...

+ Inheritance diagram for CombinedSlateTest:
+ Collaboration diagram for CombinedSlateTest:

Public Member Functions

 setUp ()
 
 getUIFactory ()
 
 testRendering ()
 
 testRenderingWithAriaRole ()
 
 testRenderingWithSubDivider ()
 
 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
 
I Button Factory $button_factory
 
I Divider Factory $divider_factory
 
I Symbol Icon Factory $icon_factory
 

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 CombinedSlateTest.php.

Member Function Documentation

◆ getUIFactory()

CombinedSlateTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 46 of file CombinedSlateTest.php.

47 {
48 $factory = new class () extends NoUIFactory {
50
51 public function button(): C\Button\Factory
52 {
54 }
55 public function glyph(): C\Symbol\Glyph\Factory
56 {
57 return new I\Symbol\Glyph\Factory();
58 }
59
60 public function divider(): C\Divider\Factory
61 {
62 return new I\Divider\Factory();
63 }
64
65 public function mainControls(): C\MainControls\Factory
66 {
67 return new I\MainControls\Factory($this->sig_gen);
68 }
69 };
70 $factory->button_factory = $this->button_factory;
71 $factory->sig_gen = $this->sig_gen;
72 return $factory;
73 }
I SignalGenerator $sig_gen
I Button Factory $button_factory
$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...

References $button_factory, $factory, and $sig_gen.

◆ setUp()

CombinedSlateTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 38 of file CombinedSlateTest.php.

38 : void
39 {
40 $this->sig_gen = new I\SignalGenerator();
41 $this->button_factory = new I\Button\Factory();
42 $this->divider_factory = new I\Divider\Factory();
43 $this->icon_factory = new I\Symbol\Icon\Factory();
44 }

◆ testRendering()

CombinedSlateTest::testRendering ( )

Definition at line 75 of file CombinedSlateTest.php.

75 : void
76 {
77 $name = 'name';
78 $icon = $this->icon_factory->custom('', '');
79 $slate = new Combined($this->sig_gen, $name, $icon);
80
81 $r = $this->getDefaultRenderer();
82 $html = $r->render($slate);
83
84 $expected = '<div class="il-maincontrols-slate disengaged" id="id_1"><div class="il-maincontrols-slate-content" data-replace-marker="content"></div></div>';
85 $this->assertEquals(
86 $expected,
87 $this->brutallyTrimHTML($html)
88 );
89 }
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
if($format !==null) $name
Definition: metadata.php:247

References $name, ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithAriaRole()

CombinedSlateTest::testRenderingWithAriaRole ( )

Definition at line 91 of file CombinedSlateTest.php.

91 : void
92 {
93 $name = 'name';
94 $icon = $this->icon_factory->custom('', '');
95 $slate = new Combined($this->sig_gen, $name, $icon);
96 $slate = $slate->withAriaRole(I\MainControls\Slate\Slate::MENU);
97
98 $r = $this->getDefaultRenderer();
99 $html = $r->render($slate);
100
101 $expected = '<div class="il-maincontrols-slate disengaged" id="id_1" role="menu"><div class="il-maincontrols-slate-content" data-replace-marker="content"></div></div>';
102 $this->assertEquals(
103 $expected,
104 $this->brutallyTrimHTML($html)
105 );
106 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $name, ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithSubDivider()

CombinedSlateTest::testRenderingWithSubDivider ( )

Definition at line 108 of file CombinedSlateTest.php.

108 : void
109 {
110 $name = 'name';
111 $icon = $this->icon_factory->custom('', '');
112 $subdivider = new I\Divider\Horizontal();
113 $subdivider_with_text = new I\Divider\Horizontal();
114 $subdivider_with_text = $subdivider_with_text->withLabel('Title');
115 $slate = new Combined($this->sig_gen, $name, $icon);
116 $slate = $slate
117 ->withAdditionalEntry($subdivider_with_text)
118 ->withAdditionalEntry($subdivider);
119
120 $r = $this->getDefaultRenderer();
121 $html = $r->render($slate);
122
123 $expected = <<<EOT
124 <div class="il-maincontrols-slate disengaged" id="id_1">
125 <div class="il-maincontrols-slate-content" data-replace-marker="content">
126 <ul>
127 <li><hr class="il-divider-with-label" /><h4 class="il-divider">Title</h4></li>
128 <li><hr /></li>
129 </ul>
130 </div>
131 </div>
132EOT;
133 $this->assertEquals(
134 $this->brutallyTrimHTML($expected),
135 $this->brutallyTrimHTML($html)
136 );
137 }
Title class.
Definition: Title.php:27

References $name, ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithSubslateAndButton()

CombinedSlateTest::testRenderingWithSubslateAndButton ( )

Definition at line 139 of file CombinedSlateTest.php.

139 : void
140 {
141 $icon = $this->icon_factory->custom('', '');
142 $subslate = new Combined($this->sig_gen, 'subslate_name', $icon);
143 $subbutton = $this->button_factory->bulky($icon, 'button_name', '');
144 $slate = new Combined($this->sig_gen, 'slate_name', $icon);
145 $slate = $slate
146 ->withAdditionalEntry($subslate)
147 ->withAdditionalEntry($subbutton);
148
149 $r = $this->getDefaultRenderer();
150 $html = $r->render($slate);
151
152 $expected = <<<EOT
153 <div class="il-maincontrols-slate disengaged" id="id_3">
154 <div class="il-maincontrols-slate-content" data-replace-marker="content">
155 <ul>
156 <li>
157 <button class="btn btn-bulky" id="id_1">
158 <img class="icon custom small" src="" alt=""/>
159 <span class="bulky-label">subslate_name</span>
160 </button>
161 <div class="il-maincontrols-slate disengaged" id="id_2">
162 <div class="il-maincontrols-slate-content" data-replace-marker="content"></div>
163 </div>
164 </li>
165 <li>
166 <button class="btn btn-bulky" data-action="">
167 <img class="icon custom small" src="" alt=""/>
168 <span class="bulky-label">button_name</span>
169 </button>
170 </li>
171 </ul>
172 </div>
173 </div>
174EOT;
175 $this->assertEquals(
176 $this->brutallyTrimHTML($expected),
177 $this->brutallyTrimHTML($html)
178 );
179 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

Field Documentation

◆ $button_factory

I Button Factory CombinedSlateTest::$button_factory
protected

Definition at line 34 of file CombinedSlateTest.php.

Referenced by getUIFactory().

◆ $divider_factory

I Divider Factory CombinedSlateTest::$divider_factory
protected

Definition at line 35 of file CombinedSlateTest.php.

◆ $icon_factory

I Symbol Icon Factory CombinedSlateTest::$icon_factory
protected

Definition at line 36 of file CombinedSlateTest.php.

◆ $sig_gen

I SignalGenerator CombinedSlateTest::$sig_gen
protected

Definition at line 33 of file CombinedSlateTest.php.

Referenced by getUIFactory().


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