ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
DividerTest.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4 
5 require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ . "/../../Base.php");
7 
8 use \ILIAS\UI\Component as C;
9 
14 {
15 
19  public function getFactory()
20  {
21  return new \ILIAS\UI\Implementation\Factory();
22  }
23 
25  {
26  $f = $this->getFactory();
27 
28  $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $f->divider()->horizontal());
29  }
30 
31  public function test_with_label()
32  {
33  $f = $this->getFactory();
34  $c = $f->divider()->horizontal()->withLabel("label");
35 
36  $this->assertEquals($c->getLabel(), "label");
37  }
38 
39  public function test_render_horizontal_empty()
40  {
41  $f = $this->getFactory();
42  $r = $this->getDefaultRenderer();
43 
44  $c = $f->divider()->horizontal();
45 
46  $html = trim($r->render($c));
47 
48  $expected_html = "<hr/>";
49 
50  $this->assertHTMLEquals($expected_html, $html);
51  }
52 
54  {
55  $f = $this->getFactory();
56  $r = $this->getDefaultRenderer();
57 
58  $c = $f->divider()->horizontal()->withLabel("label");
59 
60  $html = trim($r->render($c));
61  $expected_html = '<hr class="il-divider-with-label" /><h6 class="il-divider">label</h6>';
62 
63  $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
64  }
65 }
test_render_horizontal_empty()
Definition: DividerTest.php:39
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
test_implements_factory_interface()
Definition: DividerTest.php:24
$r
Definition: example_031.php:79
Provides common functionality for UI tests.
Definition: Base.php:177
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
$html
Definition: example_001.php:87
test_render_horizontal_with_label()
Definition: DividerTest.php:53
Test on divider implementation.
Definition: DividerTest.php:13