ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DropdownTest Class Reference

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

Protected Member Functions

 getFactory ()
 

Detailed Description

Test on card implementation.

Definition at line 14 of file DropdownTest.php.

Member Function Documentation

◆ getFactory()

DropdownTest::getFactory ( )
protected

Definition at line 16 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_with_items(), and test_with_label().

17  {
18  return new I\Component\Dropdown\Factory();
19  }
+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

DropdownTest::test_implements_factory_interface ( )

Definition at line 21 of file DropdownTest.php.

References $f, and getFactory().

22  {
23  $f = $this->getFactory();
24 
25  $this->assertInstanceOf("ILIAS\\UI\\Component\\Dropdown\\Standard", $f->standard(array()));
26  }
+ Here is the call graph for this function:

◆ test_render_empty()

DropdownTest::test_render_empty ( )

Definition at line 53 of file DropdownTest.php.

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

54  {
55  $f = $this->getFactory();
56  $r = $this->getDefaultRenderer();
57 
58  $c = $f->standard(array());
59 
60  $html = $r->render($c);
61  $expected = "";
62 
63  $this->assertEquals($expected, $html);
64  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_items()

DropdownTest::test_render_items ( )

Definition at line 66 of file DropdownTest.php.

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

67  {
68  $f = $this->getFactory();
69  $r = $this->getDefaultRenderer();
70 
71  $c = $f->standard(array(
72  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
73  new I\Component\Divider\Horizontal(),
74  new I\Component\Button\Shy("GitHub", "https://www.github.com")
75  ));
76 
77  $html = $r->render($c);
78 
79  $expected = <<<EOT
80  <div class="dropdown">
81  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false">
82  <span class="caret"></span>
83  </button>
84  <ul class="dropdown-menu">
85  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
86  <li><hr /></li>
87  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
88  </ul>
89  </div>
90 EOT;
91 
92  $this->assertHTMLEquals($expected, $html);
93  }
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_items_with_aria_label()

DropdownTest::test_render_items_with_aria_label ( )

Definition at line 121 of file DropdownTest.php.

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

122  {
123  $f = $this->getFactory();
124  $r = $this->getDefaultRenderer();
125 
126  $c = $f->standard(array(
127  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
128  new I\Component\Divider\Horizontal(),
129  new I\Component\Button\Shy("GitHub", "https://www.github.com")
130  ))->withLabel("label")->withAriaLabel("my_aria_label");
131 
132  $html = $r->render($c);
133 
134  $expected = <<<EOT
135  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="my_aria_label" aria-haspopup="true" aria-expanded="false">label <span class="caret"></span></button>
136  <ul class="dropdown-menu">
137  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
138  <li><hr /></li>
139  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
140  </ul>
141  </div>
142 EOT;
143 
144  $this->assertHTMLEquals($expected, $html);
145  }
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_items_with_label()

DropdownTest::test_render_items_with_label ( )

Definition at line 95 of file DropdownTest.php.

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

96  {
97  $f = $this->getFactory();
98  $r = $this->getDefaultRenderer();
99 
100  $c = $f->standard(array(
101  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
102  new I\Component\Divider\Horizontal(),
103  new I\Component\Button\Shy("GitHub", "https://www.github.com")
104  ))->withLabel("label");
105 
106  $html = $r->render($c);
107 
108  $expected = <<<EOT
109  <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>
110  <ul class="dropdown-menu">
111  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
112  <li><hr /></li>
113  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
114  </ul>
115  </div>
116 EOT;
117 
118  $this->assertHTMLEquals($expected, $html);
119  }
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_items()

DropdownTest::test_with_items ( )

Definition at line 37 of file DropdownTest.php.

References $c, $f, and getFactory().

38  {
39  $f = $this->getFactory();
40  $c = $f->standard(array(
41  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
42  new I\Component\Button\Shy("GitHub", "https://www.github.com"),
43  new I\Component\Divider\Horizontal(),
44  new I\Component\Button\Shy("GitHub", "https://www.github.com")
45  ));
46  $items = $c->getItems();
47 
48  $this->assertTrue(is_array($items));
49  $this->assertInstanceOf("ILIAS\\UI\\Component\\Button\\Shy", $items[0]);
50  $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $items[2]);
51  }
+ Here is the call graph for this function:

◆ test_with_label()

DropdownTest::test_with_label ( )

Definition at line 28 of file DropdownTest.php.

References $c, $f, and getFactory().

29  {
30  $f = $this->getFactory();
31 
32  $c = $f->standard(array())->withLabel("label");
33 
34  $this->assertEquals($c->getLabel(), "label");
35  }
+ Here is the call graph for this function:

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