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

Tests on implementation for the lightbox modal. More...

+ Inheritance diagram for LightboxTest:
+ Collaboration diagram for LightboxTest:

Public Member Functions

 testGetSinglePage ()
 
 testGetMultiplePage ()
 
 testSimplePageRendering (string $method, array $args, string $expected_html)
 
 testDifferentPageTypeRendering ()
 
- Public Member Functions inherited from ModalBase
 getUIFactory ()
 
 normalizeHTML (string $html)
 

Static Public Member Functions

static getPageProvider ()
 

Protected Member Functions

 getLightboxPage ()
 
- Protected Member Functions inherited from ModalBase
 getModalFactory ()
 
 getButtonFactory ()
 
 getDummyComponent ()
 

Static Protected Member Functions

static getExpectedTextPageHTML ()
 
static getExpectedImagePageHTML ()
 
static getExpectedMixedPagesHTML ()
 

Static Private Member Functions

static getExpectedCardPageHTML ()
 

Detailed Description

Tests on implementation for the lightbox modal.

Author
Stefan Wanzenried sw@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 31 of file LightboxTest.php.

Member Function Documentation

◆ getExpectedCardPageHTML()

static LightboxTest::getExpectedCardPageHTML ( )
staticprivate

Definition at line 203 of file LightboxTest.php.

203 : string
204 {
205 return <<<EOT
206<dialog class="c-modal c-modal--lightbox il-modal-lightbox il-modal-lightbox-bright" tabindex="-1" id="id_1">
207 <div class="modal-dialog modal-lg" role="document">
208 <div class="modal-content il-modal-lightbox-page">
209 <div class="modal-header">
210 <form><button formmethod="dialog" class="close" aria-label="close"><span aria-hidden="true"></span></button></form>
211 <h1 class="modal-title">foo</h1>
212 </div>
213 <div class="modal-body">
214 <div id="id_1_carousel" class="carousel slide" data-ride="carousel" data-interval="false">
215 <div class="carousel-inner" role="listbox">
216 <div class="item active" data-title="foo">
217 <div class="item-content item-vertical"></div>
218 </div>
219 </div>
220 </div>
221 </div>
222 </div>
223 </div>
224</dialog>
225EOT;
226 }
form( $class_path, string $cmd, string $submit_caption="")
button(string $caption, string $cmd)

References ILIAS\Repository\button(), Vendor\Package\foo(), and ILIAS\Repository\form().

Referenced by getPageProvider().

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

◆ getExpectedImagePageHTML()

static LightboxTest::getExpectedImagePageHTML ( )
staticprotected

Definition at line 117 of file LightboxTest.php.

117 : string
118 {
119 return <<<EOT
120<dialog class="c-modal c-modal--lightbox il-modal-lightbox il-modal-lightbox-dark" tabindex="-1" id="id_1">
121 <div class="modal-dialog modal-lg" role="document">
122 <div class="modal-content il-modal-lightbox-page">
123 <div class="modal-header">
124 <form><button formmethod="dialog" class="close" aria-label="close"><span aria-hidden="true"></span></button></form>
125 <h1 class="modal-title">title</h1>
126 </div>
127 <div class="modal-body">
128 <div id="id_1_carousel" class="carousel slide" data-ride="carousel" data-interval="false">
129
130 <div class="carousel-inner" role="listbox">
131
132 <div class="item active" data-title="title">
133 <div class="item-content ">
134 <img src="src/fake/image.jpg" class="img-responsive" alt="description" />
135 </div>
136 <div class="carousel-caption">
137 description
138 </div>
139 </div>
140
141 </div>
142
143 </div>
144 </div>
145 </div>
146 </div>
147</dialog>
148EOT;
149 }

References ILIAS\Repository\button(), and ILIAS\Repository\form().

Referenced by getPageProvider().

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

◆ getExpectedMixedPagesHTML()

static LightboxTest::getExpectedMixedPagesHTML ( )
staticprotected

Definition at line 151 of file LightboxTest.php.

151 : string
152 {
153 return <<<EOT
154<dialog class="c-modal c-modal--lightbox il-modal-lightbox il-modal-lightbox-dark" tabindex="-1" id="id_1">
155 <div class="modal-dialog modal-lg" role="document">
156 <div class="modal-content il-modal-lightbox-page">
157 <div class="modal-header">
158 <form><button formmethod="dialog" class="close" aria-label="close"><span aria-hidden="true"></span></button></form>
159 <h1 class="modal-title">title</h1>
160 </div>
161 <div class="modal-body">
162 <div id="id_1_carousel" class="carousel slide" data-ride="carousel" data-interval="false">
163
164 <ol class="carousel-indicators">
165 <li data-target="#id_1_carousel" data-slide-to="0" class="active"></li>
166 <li data-target="#id_1_carousel" data-slide-to="1" class=""></li>
167 </ol>
168
169 <div class="carousel-inner" role="listbox">
170 <div class="item active text-only" data-title="title">
171 <div class="item-content ">
173 </div>
174 </div>
175
176 <div class="item " data-title="title">
177 <div class="item-content ">
178 <img src="src/fake/image.jpg" class="img-responsive" alt="description" />
179 </div>
180 <div class="carousel-caption">
181 description
182 </div>
183 </div>
184 </div>
185
186 <button class="left carousel-control btn-link" href="#id_1_carousel" role="button" data-slide="prev">
187 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
188 <span class="sr-only">Previous</span>
189 </button>
190 <button class="right carousel-control btn-link" href="#id_1_carousel" role="button" data-slide="next">
191 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
192 <span class="sr-only">Next</span>
193 </button>
194
195 </div>
196 </div>
197 </div>
198 </div>
199</dialog>
200EOT;
201 }
Some very basic component implementation.
Definition: HelloWorld.php:27
to(\GdImage $image, ?int $quality=null)
Currently this is the only way to make a FileStream from a GD image resource.

References ILIAS\Repository\button(), ILIAS\Repository\form(), and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\to().

Referenced by testDifferentPageTypeRendering().

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

◆ getExpectedTextPageHTML()

static LightboxTest::getExpectedTextPageHTML ( )
staticprotected

Definition at line 88 of file LightboxTest.php.

88 : string
89 {
90 return <<<EOT
91<dialog class="c-modal c-modal--lightbox il-modal-lightbox il-modal-lightbox-bright" tabindex="-1" id="id_1">
92 <div class="modal-dialog modal-lg" role="document">
93 <div class="modal-content il-modal-lightbox-page">
94 <div class="modal-header">
95 <form><button formmethod="dialog" class="close" aria-label="close"><span aria-hidden="true"></span></button></form>
96 <h1 class="modal-title">title</h1>
97 </div>
98 <div class="modal-body">
99 <div id="id_1_carousel" class="carousel slide" data-ride="carousel" data-interval="false">
100
101 <div class="carousel-inner" role="listbox">
102 <div class="item active text-only" data-title="title">
103 <div class="item-content ">
105 </div>
106 </div>
107 </div>
108
109 </div>
110 </div>
111 </div>
112 </div>
113</dialog>
114EOT;
115 }

References ILIAS\Repository\button(), and ILIAS\Repository\form().

Referenced by getPageProvider().

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

◆ getLightboxPage()

LightboxTest::getLightboxPage ( )
protected

Definition at line 83 of file LightboxTest.php.

84 {
85 return new LightboxMockPage();
86 }

Referenced by testGetMultiplePage(), and testGetSinglePage().

+ Here is the caller graph for this function:

◆ getPageProvider()

static LightboxTest::getPageProvider ( )
static

Definition at line 56 of file LightboxTest.php.

56 : array
57 {
58 $image = new I\Component\Image\Image("responsive", 'src/fake/image.jpg', 'description');
59 $card = new I\Component\Card\Card('foo');
60
61 return [
62 'Render image page' => ['lightboxImagePage', [$image, 'title'], self::getExpectedImagePageHTML()],
63 'Render text page' => ['lightboxTextPage', ['HelloWorld', 'title'], self::getExpectedTextPageHTML()],
64 'Render card page' => ['lightboxCardPage', [$card], self::getExpectedCardPageHTML()],
65 ];
66 }
static getExpectedTextPageHTML()
static getExpectedCardPageHTML()
static getExpectedImagePageHTML()

References getExpectedCardPageHTML(), getExpectedImagePageHTML(), and getExpectedTextPageHTML().

+ Here is the call graph for this function:

◆ testDifferentPageTypeRendering()

LightboxTest::testDifferentPageTypeRendering ( )

Definition at line 68 of file LightboxTest.php.

68 : void
69 {
70 $image1 = new I\Component\Image\Image("responsive", 'src/fake/image.jpg', 'description');
71
72 $pages = [
73 $this->getModalFactory()->lightboxTextPage('HelloWorld', 'title'),
74 $this->getModalFactory()->lightboxImagePage($image1, 'title'),
75 ];
76
77 $lightbox = $this->getModalFactory()->lightbox($pages);
78 $expected = $this->normalizeHTML($this->getExpectedMixedPagesHTML());
79 $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($lightbox));
80 $this->assertEquals($expected, $actual);
81 }
static getExpectedMixedPagesHTML()
normalizeHTML(string $html)
Definition: ModalBase.php:75
getModalFactory()
Definition: ModalBase.php:50

References getExpectedMixedPagesHTML(), ModalBase\getModalFactory(), and ModalBase\normalizeHTML().

+ Here is the call graph for this function:

◆ testGetMultiplePage()

LightboxTest::testGetMultiplePage ( )

Definition at line 40 of file LightboxTest.php.

40 : void
41 {
42 $pages = [$this->getLightboxPage(), $this->getLightboxPage()];
43 $lightbox = $this->getModalFactory()->lightbox($pages);
44 $this->assertEquals($pages, $lightbox->getPages());
45 }

References getLightboxPage(), and ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ testGetSinglePage()

LightboxTest::testGetSinglePage ( )

Definition at line 33 of file LightboxTest.php.

33 : void
34 {
35 $page = $this->getLightboxPage();
36 $lightbox = $this->getModalFactory()->lightbox($page);
37 $this->assertEquals([$page], $lightbox->getPages());
38 }

References getLightboxPage(), and ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ testSimplePageRendering()

LightboxTest::testSimplePageRendering ( string  $method,
array  $args,
string  $expected_html 
)

Definition at line 48 of file LightboxTest.php.

48 : void
49 {
50 $lightbox = $this->getModalFactory()->lightbox($this->getModalFactory()->$method(...$args));
51 $expected = $this->normalizeHTML($expected_html);
52 $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($lightbox));
53 $this->assertEquals($expected, $actual);
54 }

References ModalBase\getModalFactory(), and ModalBase\normalizeHTML().

+ Here is the call graph for this function:

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