ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
DrilldownSlateTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21require_once("libs/composer/vendor/autoload.php");
22require_once(__DIR__ . "/../../../Base.php");
23
27
32{
33 public function getUIFactory(): NoUIFactory
34 {
35 return new class () extends NoUIFactory {
36 protected function getSigGen()
37 {
38 return new I\SignalGenerator();
39 }
40
41 public function menu(): C\Menu\Factory
42 {
43 return new I\Menu\Factory($this->getSigGen());
44 }
45
46 public function symbol(): C\Symbol\Factory
47 {
48 return new I\Symbol\Factory(
49 new I\Symbol\Icon\Factory(),
50 new I\Symbol\Glyph\Factory(),
51 new I\Symbol\Avatar\Factory()
52 );
53 }
54
55 public function mainControls(): C\MainControls\Factory
56 {
57 $slate_factory = new I\MainControls\Slate\Factory(
58 $this->getSigGen(),
59 new I\Counter\Factory(),
60 $this->symbol()
61 );
62 return new I\MainControls\Factory($this->getSigGen(), $slate_factory);
63 }
64
65 public function button(): C\Button\Factory
66 {
67 return new I\Button\Factory();
68 }
69 };
70 }
71
73 {
74 $f = $this->getUIFactory();
75 $slate = $f->mainControls()->slate()->drilldown(
76 "ddslate",
77 $f->symbol()->icon()->custom('', ''),
78 $f->menu()->drilldown('ddmenu', [])
79 );
80 $this->assertInstanceOf("ILIAS\\UI\\Component\\MainControls\\Slate\\Drilldown", $slate);
81 return $slate;
82 }
83
87 public function testRendering(Drilldown $slate): void
88 {
89 $r = $this->getDefaultRenderer();
90 $html = $r->render($slate);
91
92 $expected = '
93
94 <div class="il-maincontrols-slate disengaged" id="id_3">
95 <div class="il-maincontrols-slate-content" data-replace-marker="content">
96 <div class="il-drilldown" id="id_2">
97
98 <header class="show-title show-backnav">
99 <h2>ddmenu</h2>
100 <div class="backnav">
101 <button class="btn btn-bulky" id="id_1" aria-label="back"><span class="glyph" role="img"><span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span></span><span class="bulky-label"></span></button>
102 </div>
103 </header>
104 <ul>
105 <li><button class="menulevel" aria-expanded="false">ddmenu<span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span></button>
106 <ul></ul>
107 </li>
108 </ul>
109 </div>
110 </div>
111 </div>
112 ';
113 $this->assertEquals(
114 $this->brutallyTrimHTML($expected),
115 $this->brutallyTrimHTML($html)
116 );
117 }
118}
Tests for the DrilldownSlate.
testRendering(Drilldown $slate)
@depends testImplementsFactoryInterface
Provides common functionality for UI tests.
Definition: Base.php:299
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
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...