ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
DropdownTest 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 DropdownTest:
+ Collaboration diagram for DropdownTest:

Public Member Functions

 test_implements_factory_interface ()
 
 test_with_label ()
 
 test_with_items ()
 
 test_render_empty ()
 
 test_render_items ()
 
 test_render_items_with_label ()
 
 test_render_with_link_new_viewport ()
 
 test_render_items_with_aria_label ()
 
- 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

 getFactory ()
 
- 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 Test on card implementation.

Definition at line 30 of file DropdownTest.php.

Member Function Documentation

◆ getFactory()

DropdownTest::getFactory ( )
protected

Definition at line 32 of file DropdownTest.php.

Referenced by test_implements_factory_interface(), test_render_empty(), test_render_items(), test_render_items_with_aria_label(), test_render_items_with_label(), test_render_with_link_new_viewport(), test_with_items(), and test_with_label().

32  : C\Dropdown\Factory
33  {
34  return new I\Component\Dropdown\Factory();
35  }
+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

DropdownTest::test_implements_factory_interface ( )

Definition at line 37 of file DropdownTest.php.

References Vendor\Package\$f, and getFactory().

37  : void
38  {
39  $f = $this->getFactory();
40 
41  $this->assertInstanceOf("ILIAS\\UI\\Component\\Dropdown\\Standard", $f->standard(array()));
42  }
+ Here is the call graph for this function:

◆ test_render_empty()

DropdownTest::test_render_empty ( )

Definition at line 71 of file DropdownTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

71  : void
72  {
73  $f = $this->getFactory();
74  $r = $this->getDefaultRenderer();
75 
76  $c = $f->standard(array());
77 
78  $html = $r->render($c);
79  $expected = "";
80 
81  $this->assertEquals($expected, $html);
82  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
+ Here is the call graph for this function:

◆ test_render_items()

DropdownTest::test_render_items ( )

Definition at line 84 of file DropdownTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

84  : void
85  {
86  $f = $this->getFactory();
87  $r = $this->getDefaultRenderer();
88 
89  $c = $f->standard(array(
90  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
91  new I\Component\Divider\Horizontal(),
92  new I\Component\Button\Shy("GitHub", "https://www.github.com")
93  ));
94 
95  $html = $r->render($c);
96 
97  $expected = <<<EOT
98  <div class="dropdown">
99  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu">
100  <span class="caret"></span>
101  </button>
102  <ul id="id_3_menu" class="dropdown-menu">
103  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
104  <li><hr /></li>
105  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
106  </ul>
107  </div>
108 EOT;
109 
110  $this->assertHTMLEquals($expected, $html);
111  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
+ Here is the call graph for this function:

◆ test_render_items_with_aria_label()

DropdownTest::test_render_items_with_aria_label ( )

Definition at line 163 of file DropdownTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

163  : void
164  {
165  $f = $this->getFactory();
166  $r = $this->getDefaultRenderer();
167 
168  $c = $f->standard(array(
169  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
170  new I\Component\Divider\Horizontal(),
171  new I\Component\Button\Shy("GitHub", "https://www.github.com")
172  ))->withLabel("label")->withAriaLabel("my_aria_label");
173 
174  $html = $r->render($c);
175 
176  $expected = <<<EOT
177  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-label="my_aria_label" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu">label <span class="caret"></span></button>
178  <ul id="id_3_menu" class="dropdown-menu">
179  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
180  <li><hr /></li>
181  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
182  </ul>
183  </div>
184 EOT;
185 
186  $this->assertHTMLEquals($expected, $html);
187  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
+ Here is the call graph for this function:

◆ test_render_items_with_label()

DropdownTest::test_render_items_with_label ( )

Definition at line 113 of file DropdownTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

113  : void
114  {
115  $f = $this->getFactory();
116  $r = $this->getDefaultRenderer();
117 
118  $c = $f->standard(array(
119  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
120  new I\Component\Divider\Horizontal(),
121  new I\Component\Button\Shy("GitHub", "https://www.github.com")
122  ))->withLabel("label");
123 
124  $html = $r->render($c);
125 
126  $expected = <<<EOT
127  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu">label <span class="caret"></span></button>
128  <ul id="id_3_menu" class="dropdown-menu">
129  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
130  <li><hr /></li>
131  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
132  </ul>
133  </div>
134 EOT;
135 
136  $this->assertHTMLEquals($expected, $html);
137  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
+ Here is the call graph for this function:

◆ test_render_with_link_new_viewport()

DropdownTest::test_render_with_link_new_viewport ( )

Definition at line 139 of file DropdownTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

139  : void
140  {
141  $f = $this->getFactory();
142  $r = $this->getDefaultRenderer();
143 
144  $link = new I\Component\Link\Standard("Link to ILIAS", "http://www.ilias.de");
145 
146  $c = $f->standard(array(
147  $link->withOpenInNewViewport(true)
148  ));
149 
150  $html = $r->render($c);
151 
152  $expected = <<<EOT
153  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_1" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_1_menu"><span class="caret"></span></button>
154  <ul id="id_1_menu" class="dropdown-menu">
155  <li><a href="http://www.ilias.de" target="_blank" rel="noopener">Link to ILIAS</a></li>
156  </ul>
157  </div>
158 EOT;
159 
160  $this->assertHTMLEquals($expected, $html);
161  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
Class ChatMainBarProvider .
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
+ Here is the call graph for this function:

◆ test_with_items()

DropdownTest::test_with_items ( )

Definition at line 53 of file DropdownTest.php.

References $c, Vendor\Package\$f, and getFactory().

53  : void
54  {
55  $f = $this->getFactory();
56  $link = new I\Component\Link\Standard("Link to Github", "http://www.github.com");
57  $c = $f->standard(array(
58  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
59  new I\Component\Button\Shy("GitHub", "https://www.github.com"),
60  new I\Component\Divider\Horizontal(),
61  $link->withOpenInNewViewport(true)
62  ));
63  $items = $c->getItems();
64 
65  $this->assertTrue(is_array($items));
66  $this->assertInstanceOf("ILIAS\\UI\\Component\\Button\\Shy", $items[0]);
67  $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $items[2]);
68  $this->assertInstanceOf("ILIAS\\UI\\Component\\Link\\Standard", $items[3]);
69  }
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
+ Here is the call graph for this function:

◆ test_with_label()

DropdownTest::test_with_label ( )

Definition at line 44 of file DropdownTest.php.

References $c, Vendor\Package\$f, and getFactory().

44  : void
45  {
46  $f = $this->getFactory();
47 
48  $c = $f->standard(array())->withLabel("label");
49 
50  $this->assertEquals("label", $c->getLabel());
51  }
$c
Definition: cli.php:38
+ Here is the call graph for this function:

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