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;
18 return "\\ILIAS\\UI\\Component\\Glyph\\Glyph";
32 use \ILIAS\UI\Component\Component;
33 use \ILIAS\UI\Renderer;
34 use \ILIAS\UI\Implementation\Render\AbstractComponentRenderer;
42 return "\\ILIAS\\UI\\Component\\Counter\\Counter";
49 require_once(__DIR__.
"/../Base.php");
52 use \ILIAS\UI\Component as
C;
53 use \ILIAS\UI\Implementation\Render\Template;
54 use \ILIAS\UI\Implementation\Render\JavaScriptBinding;
55 use \ILIAS\UI\Implementation\Render\TemplateFactory;
62 public function get($name = null) {
return ""; }
68 public function getTemplate($file_name, $purge_unfilled_vars, $purge_unused_blocks) {
69 $file_name = realpath(__DIR__.
"/../../../".$file_name);
70 $this->
files[$file_name] =
array($purge_unfilled_vars, $purge_unused_blocks);
72 if (!file_exists($file_name)) {
73 throw new \InvalidArgumentException();
96 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
97 $tpl =
$r->_getTemplate(
"tpl.glyph.html",
true,
false);
100 ( realpath(__DIR__.
"/../../../src/UI/templates/default/Glyph/tpl.glyph.html")
101 =>
array(
true,
false)
104 $this->assertEquals($expected, $this->tpl_factory->files);
108 $r = new \ILIAS\UI\Implementation\Component\Counter\CounterNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
111 $tpl =
$r->_getTemplate(
"tpl.counter_foo.html",
true,
false);
112 $this->assertFalse(
"We should not get here");
116 ( realpath(__DIR__.
"/../../src/UI/templates/default/Counter/tpl.counter_foo.html")
117 =>
array(
true,
false)
119 $this->assertEquals($expected, $this->tpl_factory->files);
123 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
125 $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\
ILIAS\UI\
Component\Glyph\Glyph::SETTINGS,
"aria_label");
128 $g = $g->withOnLoadCode(
function($id) use (&$ids) {
134 $this->assertEquals($this->js_binding->ids, $ids);
135 $this->assertEquals(
array(
"id_1"), $ids);
136 $this->assertEquals(
array(
"ID: id_1"), $this->js_binding->on_load_code);
140 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
142 $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\
ILIAS\UI\
Component\Glyph\Glyph::SETTINGS,
"aria_label");
144 $g = $g->withOnLoadCode(
function($id) {
150 $this->assertFalse(
"This should not happen...");
153 $this->assertTrue(
true);
An entity that renders components to a string output.
getComponentInterfaceName()
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(C\Component $component)
render(Component $component, Renderer $default_renderer)
Provides common functionality for UI tests.
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()
render(Component $component, Renderer $default_renderer)
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.