ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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)
 getPageProvider More...
 
 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 205 of file LightboxTest.php.

References ILIAS\Repository\button(), Vendor\Package\foo(), ILIAS\Repository\form(), and ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

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

◆ getExpectedImagePageHTML()

static LightboxTest::getExpectedImagePageHTML ( )
staticprotected

Definition at line 119 of file LightboxTest.php.

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

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

◆ getExpectedMixedPagesHTML()

static LightboxTest::getExpectedMixedPagesHTML ( )
staticprotected

Definition at line 153 of file LightboxTest.php.

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

Referenced by testDifferentPageTypeRendering().

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

◆ getExpectedTextPageHTML()

static LightboxTest::getExpectedTextPageHTML ( )
staticprotected

Definition at line 90 of file LightboxTest.php.

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

90  : string
91  {
92  return <<<EOT
93 <dialog class="c-modal c-modal--lightbox il-modal-lightbox il-modal-lightbox-bright" tabindex="-1" id="id_1">
94  <div class="modal-dialog modal-lg" role="document">
95  <div class="modal-content il-modal-lightbox-page">
96  <div class="modal-header">
97  <form><button formmethod="dialog" class="close" aria-label="close"><span aria-hidden="true"></span></button></form>
98  <h1 class="modal-title">title</h1>
99  </div>
100  <div class="modal-body">
101  <div id="id_1_carousel" class="carousel slide" data-ride="carousel" data-interval="false">
102 
103  <div class="carousel-inner" role="listbox">
104  <div class="item active text-only" data-title="title">
105  <div class="item-content ">
106  HelloWorld
107  </div>
108  </div>
109  </div>
110 
111  </div>
112  </div>
113  </div>
114  </div>
115 </dialog>
116 EOT;
117  }
button(string $caption, string $cmd)
form( $class_path, string $cmd, string $submit_caption="")
Some very basic component implementation.
Definition: HelloWorld.php:26
+ Here is the call graph for this function:

◆ getLightboxPage()

LightboxTest::getLightboxPage ( )
protected

Definition at line 85 of file LightboxTest.php.

Referenced by testGetMultiplePage(), and testGetSinglePage().

86  {
87  return new LightboxMockPage();
88  }
+ Here is the caller graph for this function:

◆ getPageProvider()

static LightboxTest::getPageProvider ( )
static

Definition at line 58 of file LightboxTest.php.

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

◆ testDifferentPageTypeRendering()

LightboxTest::testDifferentPageTypeRendering ( )

Definition at line 70 of file LightboxTest.php.

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

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

◆ testGetMultiplePage()

LightboxTest::testGetMultiplePage ( )

Definition at line 40 of file LightboxTest.php.

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

40  : void
41  {
42  $pages = [$this->getLightboxPage(), $this->getLightboxPage()];
43  $lightbox = $this->getModalFactory()->lightbox($pages);
44  $this->assertEquals($pages, $lightbox->getPages());
45  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ testGetSinglePage()

LightboxTest::testGetSinglePage ( )

Definition at line 33 of file LightboxTest.php.

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

33  : void
34  {
35  $page = $this->getLightboxPage();
36  $lightbox = $this->getModalFactory()->lightbox($page);
37  $this->assertEquals([$page], $lightbox->getPages());
38  }
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

◆ testSimplePageRendering()

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

getPageProvider

Definition at line 50 of file LightboxTest.php.

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

50  : void
51  {
52  $lightbox = $this->getModalFactory()->lightbox($this->getModalFactory()->$method(...$args));
53  $expected = $this->normalizeHTML($expected_html);
54  $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($lightbox));
55  $this->assertEquals($expected, $actual);
56  }
normalizeHTML(string $html)
Definition: ModalBase.php:76
getModalFactory()
Definition: ModalBase.php:51
+ Here is the call graph for this function:

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