ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ItemShyTest Class Reference

Test items shy. More...

+ Inheritance diagram for ItemShyTest:
+ Collaboration diagram for ItemShyTest:

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testWithDescription ()
 
 testWithProperty ()
 
 testWithClose ()
 
 testWithLeadIcon ()
 
 testRenderBase ()
 
 testRenderCritical ()
 
 testRenderWithDescription ()
 
 testRenderWithProperty ()
 
 testRenderWithLeadIcon ()
 
 testRenderWithClose ()
 

Detailed Description

Test items shy.

Definition at line 30 of file ItemShyTest.php.

Member Function Documentation

◆ getFactory()

ItemShyTest::getFactory ( )

Definition at line 32 of file ItemShyTest.php.

32 : C\Item\Factory
33 {
34 return new I\Component\Item\Factory();
35 }

Referenced by testImplementsFactoryInterface(), testRenderBase(), testRenderCritical(), testWithClose(), testWithDescription(), testWithLeadIcon(), and testWithProperty().

+ Here is the caller graph for this function:

◆ testImplementsFactoryInterface()

ItemShyTest::testImplementsFactoryInterface ( )

Definition at line 37 of file ItemShyTest.php.

37 : void
38 {
39 $f = $this->getFactory();
40
41 $shy = $f->shy('shy');
42
43 $this->assertInstanceOf('ILIAS\\UI\\Component\\Item\\Shy', $shy);
44 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testRenderBase()

ItemShyTest::testRenderBase ( )

Definition at line 76 of file ItemShyTest.php.

76 : void
77 {
78 $c = $this->getFactory()->shy('shy');
79
80 $expected = <<<EOT
81<div class="il-item il-item-shy">
82 <div class="content">
83 <div class="il-item-title">shy</div>
84 </div>
85</div>
86EOT;
87
88 $this->assertHTMLEquals(
89 $this->brutallyTrimHTML($expected),
90 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
91 );
92 }
$c
Definition: deliver.php:25

References $c, and getFactory().

+ Here is the call graph for this function:

◆ testRenderCritical()

ItemShyTest::testRenderCritical ( )

Definition at line 94 of file ItemShyTest.php.

94 : void
95 {
96 $c = $this->getFactory()->shy('noid"><script>alert(\'CRITICAL\')</script');
97
98 $expected = <<<EOT
99<div class="il-item il-item-shy">
100 <div class="content">
101 <div class="il-item-title">noid"&gt;&lt;script&gt;alert('CRITICAL')&lt;/script</div>
102 </div>
103</div>
104EOT;
105
106 $this->assertHTMLEquals(
107 $this->brutallyTrimHTML($expected),
108 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
109 );
110 }

References $c, and getFactory().

+ Here is the call graph for this function:

◆ testRenderWithClose()

ItemShyTest::testRenderWithClose ( )

Definition at line 176 of file ItemShyTest.php.

176 : void
177 {
178 $c = $this->getFactory()->shy('shy')->withClose(new I\Component\Button\Close());
179
180 $expected = <<<EOT
181<div class="il-item il-item-shy">
182 <div class="content">
183 <div class="il-item-title">shy</div>
184 <button type="button" class="close" aria-label="close">
185 <span aria-hidden="true">&times;</span>
186 </button>
187 </div>
188</div>
189EOT;
190
191 $this->assertEquals(
192 $this->brutallyTrimHTML($expected),
193 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
194 );
195 }
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

◆ testRenderWithDescription()

ItemShyTest::testRenderWithDescription ( )

Definition at line 112 of file ItemShyTest.php.

112 : void
113 {
114 $c = $this->getFactory()->shy('shy')->withDescription('This is a shy');
115
116 $expected = <<<EOT
117<div class="il-item il-item-shy">
118 <div class="content">
119 <div class="il-item-title">shy</div>
120 <div class="il-item-description">This is a shy</div>
121 </div>
122</div>
123EOT;
124
125 $this->assertHTMLEquals(
126 $this->brutallyTrimHTML($expected),
127 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
128 );
129 }

◆ testRenderWithLeadIcon()

ItemShyTest::testRenderWithLeadIcon ( )

Definition at line 155 of file ItemShyTest.php.

155 : void
156 {
157 $c = $this->getFactory()->shy('shy')->withLeadIcon(
158 new I\Component\Symbol\Icon\Standard('name', 'aria_label', 'small', false)
159 );
160
161 $expected = <<<EOT
162<div class="il-item il-item-shy">
163 <img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="aria_label" />
164 <div class="content">
165 <div class="il-item-title">shy</div>
166 </div>
167</div>
168EOT;
169
170 $this->assertHTMLEquals(
171 $this->brutallyTrimHTML($expected),
172 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
173 );
174 }

◆ testRenderWithProperty()

ItemShyTest::testRenderWithProperty ( )

Definition at line 131 of file ItemShyTest.php.

131 : void
132 {
133 $c = $this->getFactory()->shy('shy')->withProperties(['name' => 'value']);
134
135 $expected = <<<EOT
136<div class="il-item il-item-shy">
137 <div class="content">
138 <div class="il-item-title">shy</div>
139 <hr class="il-item-divider" />
140 <div class="il-item-properties">
141 <div class="il-item-property-name">name</div>
142 <div class="il-item-property-value">value</div>
143 </div>
144 </div>
145</div>
146EOT;
147
148 $this->assertHTMLEquals(
149 $this->brutallyTrimHTML($expected),
150 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
151 );
152 }

◆ testWithClose()

ItemShyTest::testWithClose ( )

Definition at line 60 of file ItemShyTest.php.

60 : void
61 {
62 $f = $this->getFactory();
63 $c = $f->shy('shy')->withClose((new I\Component\Button\Factory())->close());
64 $this->assertInstanceOf(I\Component\Button\Close::class, $c->getClose());
65 }

References $c, Vendor\Package\$f, ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getFactory().

+ Here is the call graph for this function:

◆ testWithDescription()

ItemShyTest::testWithDescription ( )

Definition at line 46 of file ItemShyTest.php.

46 : void
47 {
48 $f = $this->getFactory();
49 $c = $f->shy('shy')->withDescription('This is a shy');
50 $this->assertEquals('This is a shy', $c->getDescription());
51 }

References $c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testWithLeadIcon()

ItemShyTest::testWithLeadIcon ( )

Definition at line 67 of file ItemShyTest.php.

67 : void
68 {
69 $f = $this->getFactory();
70 $c = $f->shy('shy')->withLeadIcon(
71 (new I\Component\Symbol\Icon\Factory())->standard('name', 'label')
72 );
73 $this->assertInstanceOf(I\Component\Symbol\Icon\Icon::class, $c->getLeadIcon());
74 }

References $c, Vendor\Package\$f, getFactory(), and ILIAS\UI\examples\MainControls\Slate\Notification\standard().

+ Here is the call graph for this function:

◆ testWithProperty()

ItemShyTest::testWithProperty ( )

Definition at line 53 of file ItemShyTest.php.

53 : void
54 {
55 $f = $this->getFactory();
56 $c = $f->shy('shy')->withProperties(['name' => 'value']);
57 $this->assertEquals(['name' => 'value'], $c->getProperties());
58 }

References $c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

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