ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
DrilldownSlateTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once("vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ . "/../../../Base.php");
23 
24 use ILIAS\UI\Component as C;
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(): I\Menu\Factory
42  {
43  return new I\Menu\Factory(
44  $this->getSigGen(),
45  );
46  }
47 
48  public function symbol(): I\Symbol\Factory
49  {
50  return new I\Symbol\Factory(
51  new I\Symbol\Icon\Factory(),
52  new I\Symbol\Glyph\Factory(),
53  new I\Symbol\Avatar\Factory()
54  );
55  }
56 
57  public function mainControls(): I\MainControls\Factory
58  {
59  $slate_factory = new I\MainControls\Slate\Factory(
60  $this->getSigGen(),
61  new I\Counter\Factory(),
62  $this->symbol()
63  );
64  return new I\MainControls\Factory($this->getSigGen(), $slate_factory);
65  }
66 
67  public function button(): I\Button\Factory
68  {
69  return new I\Button\Factory();
70  }
71  };
72  }
73 
75  {
76  $f = $this->getUIFactory();
77  $slate = $f->mainControls()->slate()->drilldown(
78  "ddslate",
79  $f->symbol()->icon()->custom('', ''),
80  $f->menu()->drilldown('ddmenu', [])
81  );
82  $this->assertInstanceOf("ILIAS\\UI\\Component\\MainControls\\Slate\\Drilldown", $slate);
83  return $slate;
84  }
85 
89  public function testRendering(Drilldown $slate): void
90  {
91  $r = $this->getDefaultRenderer();
92  $html = $r->render($slate);
93 
94  $expected = '
95  <div class="il-maincontrols-slate disengaged" id="id_4">
96  <div class="il-maincontrols-slate-content" data-replace-marker="content">
97  <section class="c-drilldown" id="id_2">
98  <header class="c-drilldown__header--showbacknav">
99  <div></div>
100  <div></div>
101  <div class="c-drilldown__filter">
102  <label for=\'id_3\' class="control-label">filter_nodes_in</label>
103  <input id=\'id_3\' type="text" class="form-control" />
104  </div>
105  <div class="c-drilldown__backnav">
106  <button class="btn btn-bulky" id="id_1" aria-label="back">
107  <span class="glyph" aria-label="collapse/back" role="img">
108  <span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span>
109  </span>
110  <span class="bulky-label"></span>
111  </button>
112  </div>
113  </header>
114  <div class="c-drilldown__menu">
115  <ul aria-live="polite" aria-label="ddmenu">
116  <li class="c-drilldown__menu--no-items"> drilldown_no_items</li>
117  </ul>
118  </div>
119  </section>
120  </div>
121  </div>
122  ';
123  $this->assertEquals(
124  $this->brutallyTrimHTML($expected),
125  $this->brutallyTrimHTML($html)
126  );
127  }
128 }
button(string $caption, string $cmd)
testRendering(Drilldown $slate)
testImplementsFactoryInterface
Tests for the DrilldownSlate.
$r