ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

Referenced by testSimpleRendering().

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>
103 EOT;
104  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
form( $class_path, string $cmd, string $submit_caption="")
+ 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.

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

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
getDummyComponent()
Definition: ModalBase.php:70
getModalFactory()
Definition: ModalBase.php:50
+ Here is the call graph for this function:

◆ testGetContent()

RoundTripTest::testGetContent ( )

Definition at line 36 of file RoundTripTest.php.

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

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  }
getDummyComponent()
Definition: ModalBase.php:70
getModalFactory()
Definition: ModalBase.php:50
+ Here is the call graph for this function:

◆ testGetTitle()

RoundTripTest::testGetTitle ( )

Definition at line 30 of file RoundTripTest.php.

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

30  : void
31  {
32  $roundtrip = $this->getModalFactory()->roundtrip('myTitle', $this->getDummyComponent());
33  $this->assertEquals('myTitle', $roundtrip->getTitle());
34  }
getDummyComponent()
Definition: ModalBase.php:70
getModalFactory()
Definition: ModalBase.php:50
+ Here is the call graph for this function:

◆ testSimpleRendering()

RoundTripTest::testSimpleRendering ( )

Definition at line 70 of file RoundTripTest.php.

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

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  }
getButtonFactory()
Definition: ModalBase.php:65
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
Definition: standard.php:38
getUIFactory()
Definition: ModalBase.php:36
legacy()
expected output: > ILIAS shows the rendered Component.
Definition: legacy.php:29
getModalFactory()
Definition: ModalBase.php:50
+ Here is the call graph for this function:

◆ testWithActionButtons()

RoundTripTest::testWithActionButtons ( )

Definition at line 57 of file RoundTripTest.php.

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

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  }
getButtonFactory()
Definition: ModalBase.php:65
getDummyComponent()
Definition: ModalBase.php:70
getModalFactory()
Definition: ModalBase.php:50
+ Here is the call graph for this function:

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