6 require_once(
"libs/composer/vendor/autoload.php");
8 use \ILIAS\UI\Component\Component;
9 use \ILIAS\UI\Renderer;
10 use \ILIAS\UI\Implementation\Render\AbstractComponentRenderer;
23 return "\\ILIAS\\UI\\Component\\Glyph\\Glyph";
39 use \ILIAS\UI\Component\Component;
40 use \ILIAS\UI\Renderer;
41 use \ILIAS\UI\Implementation\Render\AbstractComponentRenderer;
54 return "\\ILIAS\\UI\\Component\\Counter\\Counter";
61 require_once(__DIR__ .
"/../Base.php");
64 use \ILIAS\UI\Component as
C;
65 use \ILIAS\UI\Implementation\Render\Template;
66 use \ILIAS\UI\Implementation\Render\JavaScriptBinding;
67 use \ILIAS\UI\Implementation\Render\TemplateFactory;
83 public function get(
$name = null)
96 public function getTemplate($file_name, $purge_unfilled_vars, $purge_unused_blocks)
98 $file_name = realpath(__DIR__ .
"/../../../" . $file_name);
99 $this->
files[$file_name] =
array($purge_unfilled_vars, $purge_unused_blocks);
101 if (!file_exists($file_name)) {
102 throw new \InvalidArgumentException();
138 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
139 $tpl =
$r->_getTemplate(
"tpl.glyph.html",
true,
false);
141 $expected =
array( realpath(__DIR__ .
"/../../../src/UI/templates/default/Glyph/tpl.glyph.html")
142 =>
array(
true,
false)
145 $this->assertEquals($expected, $this->tpl_factory->files);
150 $r = new \ILIAS\UI\Implementation\Component\Counter\CounterNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
153 $tpl =
$r->_getTemplate(
"tpl.counter_foo.html",
true,
false);
154 $this->assertFalse(
"We should not get here");
158 $expected =
array( realpath(__DIR__ .
"/../../src/UI/templates/default/Counter/tpl.counter_foo.html")
159 =>
array(
true,
false)
161 $this->assertEquals($expected, $this->tpl_factory->files);
166 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
168 $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\
ILIAS\
UI\
Component\Glyph\Glyph::SETTINGS,
"aria_label");
171 $g = $g->withOnLoadCode(
function (
$id) use (&$ids) {
177 $this->assertEquals($this->js_binding->ids, $ids);
178 $this->assertEquals(
array(
"id_1"), $ids);
179 $this->assertEquals(
array(
"ID: id_1"), $this->js_binding->on_load_code);
184 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
186 $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\
ILIAS\
UI\
Component\Glyph\Glyph::SETTINGS,
"aria_label");
188 $g = $g->withOnLoadCode(
function (
$id) {
194 $this->assertFalse(
"This should not happen...");
196 $this->assertTrue(
true);
An entity that renders components to a string output.
getComponentInterfaceName()
if(!array_key_exists('StateId', $_REQUEST)) $id
Interface to templating as it is used in the UI framework.
getTemplate($file_name, $purge_unfilled_vars, $purge_unused_blocks)
Get template instance.
render(Component $component, Renderer $default_renderer)
test_bindJavaScript_no_string()
setVariable($name, $value)
Set a variable in the current block.
render(Component $component, Renderer $default_renderer)
Provides common functionality for UI tests.
withAdditionalContext(C\Component $context)
addOnLoadCode($code)
Add some javascript to be executed on_load of the rendered page.
setCurrentBlock($name)
Set the block to work on.
test_getTemplate_unsuccessfull()
Create styles array
The data for the language used.
test_getTemplate_successfull()
renderAsync($component)
Same as render, except that this version also returns any javascript code bound to the on load event...
render(Component $component, Renderer $default_renderer)
render($component)
Render given component.
getComponentInterfaceName()
parseCurrentBlock()
Parse the block that is currently worked on.
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
Interface for a factory that provides templates.
test_bindJavaScript_successfull()
Base class for all component renderers.
touchBlock($name)
Touch a block without working further on it.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.