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

Protected Attributes

I SignalGenerator $sig_gen
 
I Button Factory $button_factory
 
I Divider Factory $divider_factory
 
I Symbol Icon Factory $icon_factory
 

Detailed Description

Tests for the Slate.

Definition at line 31 of file CombinedSlateTest.php.

Member Function Documentation

◆ getUIFactory()

CombinedSlateTest::getUIFactory ( )

Definition at line 46 of file CombinedSlateTest.php.

47 {
48 $factory = new class () extends NoUIFactory {
49 public I\SignalGenerator $sig_gen;
50 public I\Button\Factory $button_factory;
51
52 public function button(): I\Button\Factory
53 {
55 }
56
57 public function divider(): I\Divider\Factory
58 {
59 return new I\Divider\Factory();
60 }
61 };
62 $factory->button_factory = $this->button_factory;
63 $factory->sig_gen = $this->sig_gen;
64 return $factory;
65 }
I SignalGenerator $sig_gen
I Button Factory $button_factory
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 $button_factory, $sig_gen, and ILIAS\Repository\button().

+ Here is the call graph for this function:

◆ setUp()

CombinedSlateTest::setUp ( )

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 67 of file CombinedSlateTest.php.

67 : void
68 {
69 $name = 'name';
70 $icon = $this->icon_factory->custom('', '');
71 $slate = new Combined($this->sig_gen, $name, $icon);
72
73 $r = $this->getDefaultRenderer();
74 $html = $r->render($slate);
75
76 $expected = '<div class="il-maincontrols-slate disengaged" id="id_1"><div class="il-maincontrols-slate-content" data-replace-marker="content"></div></div>';
77 $this->assertEquals(
78 $expected,
79 $this->brutallyTrimHTML($html)
80 );
81 }

◆ testRenderingWithAriaRole()

CombinedSlateTest::testRenderingWithAriaRole ( )

Definition at line 83 of file CombinedSlateTest.php.

83 : void
84 {
85 $name = 'name';
86 $icon = $this->icon_factory->custom('', '');
87 $slate = new Combined($this->sig_gen, $name, $icon);
88 $slate = $slate->withAriaRole(I\MainControls\Slate\Slate::MENU);
89
90 $r = $this->getDefaultRenderer();
91 $html = $r->render($slate);
92
93 $expected = '<div class="il-maincontrols-slate disengaged" id="id_1" role="menu"><div class="il-maincontrols-slate-content" data-replace-marker="content"></div></div>';
94 $this->assertEquals(
95 $expected,
96 $this->brutallyTrimHTML($html)
97 );
98 }

◆ testRenderingWithSubDivider()

CombinedSlateTest::testRenderingWithSubDivider ( )

Definition at line 100 of file CombinedSlateTest.php.

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

◆ testRenderingWithSubslateAndButton()

CombinedSlateTest::testRenderingWithSubslateAndButton ( )

Definition at line 131 of file CombinedSlateTest.php.

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

References ILIAS\Repository\button().

+ 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: