ILIAS  release_8 Revision v8.24
RoundTripTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for RoundTripTest:
+ Collaboration diagram for RoundTripTest:

Public Member Functions

 test_get_title ()
 
 test_get_content ()
 
 test_get_action_buttons ()
 
 test_with_action_buttons ()
 
 test_simple_rendering ()
 
- Public Member Functions inherited from ModalBase
 getUIFactory ()
 
 normalizeHTML (string $html)
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 getExpectedHTML ()
 
- Protected Member Functions inherited from ModalBase
 getModalFactory ()
 
 getButtonFactory ()
 
 getDummyComponent ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Tests on implementation for the roundtrip modal

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

Definition at line 28 of file RoundTripTest.php.

Member Function Documentation

◆ getExpectedHTML()

RoundTripTest::getExpectedHTML ( )
protected

Definition at line 82 of file RoundTripTest.php.

82 : string
83 {
84 return <<<EOT
85<div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_1">
86 <div class="modal-dialog" role="document" data-replace-marker="component">
87 <div class="modal-content">
88 <div class="modal-header">
89 <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true"></span></button><span class="modal-title">Title</span>
90 </div>
91 <div class="modal-body">Content</div>
92 <div class="modal-footer">
93 <button class="btn btn-default btn-primary" data-action="">Action 1</button>
94 <button class="btn btn-default" data-action="">Action 2</button>
95 <button class="btn btn-default" data-dismiss="modal">cancel</button>
96 </div>
97 </div>
98 </div>
99</div>
100EOT;
101 }
Title class.
Definition: Title.php:27

Referenced by test_simple_rendering().

+ Here is the caller graph for this function:

◆ test_get_action_buttons()

RoundTripTest::test_get_action_buttons ( )

Definition at line 46 of file RoundTripTest.php.

46 : void
47 {
48 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
49 $action_buttons = [
50 $this->getButtonFactory()->primary('Action 1', ''),
51 $this->getButtonFactory()->standard('Action 2', ''),
52 ];
53 $roundtrip = $roundtrip->withActionButtons($action_buttons);
54 $this->assertEquals($action_buttons, $roundtrip->getActionButtons());
55 }
getButtonFactory()
Definition: ModalBase.php:62
getModalFactory()
Definition: ModalBase.php:51
getDummyComponent()
Definition: ModalBase.php:67

References ModalBase\getButtonFactory(), ModalBase\getDummyComponent(), and ModalBase\getModalFactory().

+ Here is the call graph for this function:

◆ test_get_content()

RoundTripTest::test_get_content ( )

Definition at line 36 of file RoundTripTest.php.

36 : void
37 {
38 $content = $this->getDummyComponent();
39 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $content);
40 $this->assertEquals([$content], $roundtrip->getContent());
41 $content = [$this->getDummyComponent(), $this->getDummyComponent()];
42 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $content);
43 $this->assertEquals($content, $roundtrip->getContent());
44 }

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

+ Here is the call graph for this function:

◆ test_get_title()

RoundTripTest::test_get_title ( )

Definition at line 30 of file RoundTripTest.php.

30 : void
31 {
32 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
33 $this->assertEquals('myTitle', $roundtrip->getTitle());
34 }

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

+ Here is the call graph for this function:

◆ test_simple_rendering()

RoundTripTest::test_simple_rendering ( )

Definition at line 70 of file RoundTripTest.php.

70 : void
71 {
72 $roundtrip = $this->getModalFactory()->roundtrip('Title', $this->getUIFactory()->legacy('Content'))
73 ->withActionButtons([
74 $this->getButtonFactory()->primary('Action 1', ''),
75 $this->getButtonFactory()->standard('Action 2', ''),
76 ]);
77 $expected = $this->brutallyTrimHTML($this->getExpectedHTML());
78 $actual = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($roundtrip));
79 $this->assertHTMLEquals($expected, $actual);
80 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
getUIFactory()
Definition: ModalBase.php:36
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
Definition: standard.php:16

References ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ModalBase\getButtonFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), getExpectedHTML(), ModalBase\getModalFactory(), ModalBase\getUIFactory(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), and ILIAS\UI\examples\MainControls\Slate\Notification\standard().

+ Here is the call graph for this function:

◆ test_with_action_buttons()

RoundTripTest::test_with_action_buttons ( )

Definition at line 57 of file RoundTripTest.php.

57 : void
58 {
59 $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
60 $action_buttons = [
61 $this->getButtonFactory()->primary('Action 1', ''),
62 $this->getButtonFactory()->standard('Action 2', ''),
63 ];
64 $roundtrip2 = $roundtrip->withActionButtons($action_buttons);
65 $this->assertCount(0, $roundtrip->getActionButtons());
66 $this->assertCount(2, $roundtrip2->getActionButtons());
67 $this->assertEquals($action_buttons, $roundtrip2->getActionButtons());
68 }

References ModalBase\getButtonFactory(), ModalBase\getDummyComponent(), and ModalBase\getModalFactory().

+ Here is the call graph for this function:

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