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

Test on card implementation. More...

+ Inheritance diagram for DropdownTest:
+ Collaboration diagram for DropdownTest:

Public Member Functions

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

Detailed Description

Test on card implementation.

Definition at line 13 of file DropdownTest.php.

Member Function Documentation

◆ getFactory()

DropdownTest::getFactory ( )
Returns
\ILIAS\UI\Implementation\Factory

Definition at line 19 of file DropdownTest.php.

20 {
21 return new \ILIAS\UI\Implementation\Factory();
22 }

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

+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

DropdownTest::test_implements_factory_interface ( )

Definition at line 24 of file DropdownTest.php.

25 {
26 $f = $this->getFactory();
27
28 $this->assertInstanceOf("ILIAS\\UI\\Component\\Dropdown\\Standard", $f->dropdown()->standard(array()));
29 }

References getFactory().

+ Here is the call graph for this function:

◆ test_render_empty()

DropdownTest::test_render_empty ( )

Definition at line 56 of file DropdownTest.php.

57 {
58 $f = $this->getFactory();
59 $r = $this->getDefaultRenderer();
60
61 $c = $f->dropdown()->standard(array());
62
63 $html = $r->render($c);
64 $expected = "";
65
66 $this->assertEquals($expected, $html);
67 }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

References $html, $r, ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_items()

DropdownTest::test_render_items ( )

Definition at line 69 of file DropdownTest.php.

70 {
71 $f = $this->getFactory();
72 $r = $this->getDefaultRenderer();
73
74 $c = $f->dropdown()->standard(array(
75 $f->button()->shy("ILIAS", "https://www.ilias.de"),
76 $f->divider()->horizontal(),
77 $f->button()->shy("GitHub", "https://www.github.com")
78 ));
79
80 $html = $r->render($c);
81
82 $expected = <<<EOT
83 <div class="dropdown">
84 <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
85 <span class="caret"></span>
86 </button>
87 <ul class="dropdown-menu">
88 <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de">ILIAS</a></li>
89 <li><hr /></li>
90 <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com">GitHub</a></li>
91 </ul>
92 </div>
93EOT;
94
95 $this->assertHTMLEquals($expected, $html);
96 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Class BaseForm.
$this data['403_header']

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_items_with_label()

DropdownTest::test_render_items_with_label ( )

Definition at line 98 of file DropdownTest.php.

99 {
100 $f = $this->getFactory();
101 $r = $this->getDefaultRenderer();
102
103 $c = $f->dropdown()->standard(array(
104 $f->button()->shy("ILIAS", "https://www.ilias.de"),
105 $f->divider()->horizontal(),
106 $f->button()->shy("GitHub", "https://www.github.com")
107 ))->withLabel("label");
108
109 $html = $r->render($c);
110
111 $expected = <<<EOT
112 <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">label <span class="caret"></span></button>
113 <ul class="dropdown-menu">
114 <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de">ILIAS</a></li>
115 <li><hr /></li>
116 <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com">GitHub</a></li>
117 </ul>
118 </div>
119EOT;
120
121 $this->assertHTMLEquals($expected, $html);
122 }

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_with_items()

DropdownTest::test_with_items ( )

Definition at line 40 of file DropdownTest.php.

41 {
42 $f = $this->getFactory();
43 $c = $f->dropdown()->standard(array(
44 $f->button()->shy("ILIAS", "https://www.ilias.de"),
45 $f->button()->shy("GitHub", "https://www.github.com"),
46 $f->divider()->horizontal(),
47 $f->button()->shy("GitHub", "https://www.github.com")
48 ));
49 $items = $c->getItems();
50
51 $this->assertTrue(is_array($items));
52 $this->assertInstanceOf("ILIAS\\UI\\Component\\Button\\Shy", $items[0]);
53 $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $items[2]);
54 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_label()

DropdownTest::test_with_label ( )

Definition at line 31 of file DropdownTest.php.

32 {
33 $f = $this->getFactory();
34
35 $c = $f->dropdown()->standard(array())->withLabel("label");
36
37 $this->assertEquals($c->getLabel(), "label");
38 }

References getFactory().

+ Here is the call graph for this function:

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