ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
LightboxTest Class Reference

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

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

Public Member Functions

 test_get_single_page ()
 
 test_get_multiple_page ()
 
 test_simple_rendering ()
 
- Public Member Functions inherited from ModalBase
 getUIFactory ()
 
 normalizeHTML ($html)
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

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

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 12 of file LightboxTest.php.

Member Function Documentation

◆ getExpectedHTML()

LightboxTest::getExpectedHTML ( )
protected

Definition at line 42 of file LightboxTest.php.

References data.

Referenced by test_simple_rendering().

43  {
44  $expected = <<<EOT
45 <div class="modal fade il-modal-lightbox" tabindex="-1" role="dialog" id="id_1">
46  <div class="modal-dialog modal-lg" role="document">
47  <div class="modal-content il-modal-lightbox-page">
48  <div class="modal-header">
49  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
50  <h4 class="modal-title">title</h4>
51  </div>
52  <div class="modal-body">
53  <div id="id_1_carousel" class="carousel slide" data-ride="carousel" data-interval="false">
54 
55 
56 
57  <div class="carousel-inner" role="listbox">
58 
59  <div class="item active" data-title="title">
60 
61 
62 
63 <img src="src/fake/image.jpg" class="img-responsive" alt="description" />
64 
65  <div class="carousel-caption">
66  description
67  </div>
68  </div>
69 
70  </div>
71 
72 
73 
74  </div>
75  </div>
76  </div>
77  </div>
78 </div>
79 <script>
80  $(function() {
81  $('#id_1').on('shown.bs.modal', function() {
82  $('.modal-backdrop.in').css('opacity', '0.9');
83  });
84  $('#id_1_carousel').on('slid.bs.carousel', function() {
85  var title = $(this).find('.carousel-inner .item.active').attr('data-title');
86  $('#id_1').find('.modal-title').text(title);
87  });
88  });
89 </script>
90 EOT;
91 
92  return $expected;
93  }
Add some data
+ Here is the caller graph for this function:

◆ getLightboxPage()

LightboxTest::getLightboxPage ( )
protected

Definition at line 37 of file LightboxTest.php.

Referenced by test_get_multiple_page(), and test_get_single_page().

38  {
39  return new LightboxMockPage();
40  }
+ Here is the caller graph for this function:

◆ test_get_multiple_page()

LightboxTest::test_get_multiple_page ( )

Definition at line 21 of file LightboxTest.php.

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

22  {
23  $pages = [$this->getLightboxPage(), $this->getLightboxPage()];
24  $lightbox = $this->getModalFactory()->lightbox($pages);
25  $this->assertEquals($pages, $lightbox->getPages());
26  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_get_single_page()

LightboxTest::test_get_single_page ( )

Definition at line 14 of file LightboxTest.php.

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

15  {
16  $page = $this->getLightboxPage();
17  $lightbox = $this->getModalFactory()->lightbox($page);
18  $this->assertEquals([$page], $lightbox->getPages());
19  }
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

◆ test_simple_rendering()

LightboxTest::test_simple_rendering ( )

Definition at line 28 of file LightboxTest.php.

References ILIAS_UI_TestBase\getDefaultRenderer(), getExpectedHTML(), ModalBase\getModalFactory(), ModalBase\getUIFactory(), and ModalBase\normalizeHTML().

29  {
30  $image = $this->getUIFactory()->image()->responsive('src/fake/image.jpg', 'description');
31  $lightbox = $this->getModalFactory()->lightbox($this->getUIFactory()->modal()->lightboxImagePage($image, 'title'));
32  $expected = $this->normalizeHTML($this->getExpectedHTML());
33  $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($lightbox));
34  $this->assertEquals($expected, $actual);
35  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getUIFactory()
Definition: ModalBase.php:14
normalizeHTML($html)
Definition: ModalBase.php:34
getModalFactory()
Definition: ModalBase.php:19
+ Here is the call graph for this function:

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