ILIAS  release_8 Revision v8.24
DividerTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
22require_once(__DIR__ . "/../../Base.php");
23
26
31{
32 protected function getFactory(): C\Divider\Factory
33 {
34 return new I\Component\Divider\Factory();
35 }
36
37 public function test_implements_factory_interface(): void
38 {
39 $f = $this->getFactory();
40
41 $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $f->horizontal());
42 }
43
44 public function test_with_label(): void
45 {
46 $f = $this->getFactory();
47 $c = $f->horizontal()->withLabel("label");
48
49 $this->assertEquals("label", $c->getLabel());
50 }
51
52 public function test_render_horizontal_empty(): void
53 {
54 $f = $this->getFactory();
55 $r = $this->getDefaultRenderer();
56
57 $c = $f->horizontal();
58
59 $html = trim($r->render($c));
60
61 $expected_html = "<hr/>";
62
63 $this->assertHTMLEquals($expected_html, $html);
64 }
65
66 public function test_render_horizontal_with_label(): void
67 {
68 $f = $this->getFactory();
69 $r = $this->getDefaultRenderer();
70
71 $c = $f->horizontal()->withLabel("label");
72
73 $html = trim($r->render($c));
74 $expected_html = '<hr class="il-divider-with-label" /><h4 class="il-divider">label</h4>';
75
76 $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
77 }
78
79 public function test_render_vertical(): void
80 {
81 $f = $this->getFactory();
82 $r = $this->getDefaultRenderer();
83
84 $c = $f->vertical();
85
86 $html = trim($r->render($c));
87 $expected_html = '<span class="glyphicon il-divider-vertical" aria-hidden="true"></span>';
88
89 $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
90 }
91}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: DividerTest.php:31
test_implements_factory_interface()
Definition: DividerTest.php:37
test_render_horizontal_with_label()
Definition: DividerTest.php:66
test_render_horizontal_empty()
Definition: DividerTest.php:52
test_render_vertical()
Definition: DividerTest.php:79
Provides common functionality for UI tests.
Definition: Base.php:299
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
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...
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...