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

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

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

Public Member Functions

 testGetTitle ()
 
 testGetContent ()
 
 testGetActionButtons ()
 
 testWithActionButtons ()
 
 testSimpleRendering ()
 
- Public Member Functions inherited from ModalBase
 getUIFactory ()
 
 normalizeHTML (string $html)
 

Protected Member Functions

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

Detailed Description

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<dialog class="c-modal il-modal-roundtrip" tabindex="-1" 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 <form><button formmethod="dialog" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button></form>
90 <h1 class="modal-title">Title</h1>
91 </div>
92 <div class="modal-body">Content</div>
93 <div class="modal-footer">
94 <form>
95 <button class="btn btn-default btn-primary" data-action="">Action 1</button>
96 <button class="btn btn-default" data-action="">Action 2</button>
97 <button formmethod="dialog" class="btn btn-default" data-dismiss="modal">cancel</button>
98 </form>
99 </div>
100 </div>
101 </div>
102</dialog>
103EOT;
104 }
Title class.
Definition: Title.php:42
form( $class_path, string $cmd, string $submit_caption="")
button(string $caption, string $cmd)

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

Referenced by testSimpleRendering().

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

◆ testGetActionButtons()

RoundTripTest::testGetActionButtons ( )

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:65
getModalFactory()
Definition: ModalBase.php:50
getDummyComponent()
Definition: ModalBase.php:70

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

+ Here is the call graph for this function:

◆ testGetContent()

RoundTripTest::testGetContent ( )

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:

◆ testGetTitle()

RoundTripTest::testGetTitle ( )

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:

◆ testSimpleRendering()

RoundTripTest::testSimpleRendering ( )

Definition at line 70 of file RoundTripTest.php.

70 : void
71 {
72 $roundtrip = $this->getModalFactory()->roundtrip('Title', $this->getUIFactory()->legacy()->content('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 }
getUIFactory()
Definition: ModalBase.php:36

References ModalBase\getButtonFactory(), 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:

◆ testWithActionButtons()

RoundTripTest::testWithActionButtons ( )

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: