5 require_once(__DIR__ .
"/TestComponent.php");
6 require_once(__DIR__ .
"/../Base.php");
8 use \ILIAS\UI\Component as
C;
9 use \ILIAS\UI\Implementation\DefaultRenderer;
10 use \ILIAS\UI\Implementation\Glyph\Renderer as GlyphRenderer;
18 $r = $dr->_getRendererFor(
new \
ILIAS\
UI\Implementation\
Component\Glyph\Glyph(
"up",
"up"));
19 $this->assertInstanceOf(\
ILIAS\
UI\Implementation\Render\ComponentRenderer::class,
$r);
25 $r1 = $dr->_getRendererFor(
new \
ILIAS\
UI\Implementation\
Component\Glyph\Glyph(
"up",
"up"));
26 $r2 = $dr->_getRendererFor(
new \
ILIAS\
UI\Implementation\
Component\Glyph\Glyph(
"up",
"up"));
27 $this->assertTrue($r1 === $r2,
"Instances not equal");
32 $this->resource_registry = parent::getResourceRegistry();
33 return $this->resource_registry;
39 $component = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
41 $dr->render($component);
43 $this->assertEquals(
array(
"test.js"), $this->resource_registry->resources);
49 $component = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
50 $dr2 = $dr->withAdditionalContext($component);
51 $this->assertNotSame($dr, $dr2);
57 $c1 = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
58 $c2 = new \ILIAS\UI\Component\Test\TestComponent(
"bar");
60 ->withAdditionalContext($c1)
61 ->withAdditionalContext($c2);
62 $this->assertEquals([], $dr->_getContexts());
63 $this->assertEquals([$c1, $c2], $dr2->_getContexts());
69 ->getMockBuilder(\
ILIAS\
UI\Implementation\Render\Loader::class)
70 ->setMethods([
"getRendererFor",
"getRendererFactoryFor"])
75 $c1 = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
76 $c2 = new \ILIAS\UI\Component\Test\TestComponent(
"bar");
79 ->withAdditionalContext($c1)
80 ->withAdditionalContext($c2);
83 ->expects($this->once())
84 ->method(
"getRendererFor")
85 ->with($c1, [$c1, $c2]);
87 $renderer->_getRendererFor($c1);
92 $c1 = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
94 $html = $renderer->render($c1);
95 $this->assertEquals(
"foo",
$html);
100 $c1 = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
102 new \
ILIAS\
UI\Implementation\Render\ilJavaScriptBinding(
106 $html = $renderer->renderAsync($c1);
107 $this->assertEquals(
"foo",
$html);
112 $c1 = new \ILIAS\UI\Component\Test\JSTestComponent(
"foo");
116 $html = $renderer->renderAsync($c1);
117 $this->assertEquals(
'foo<script>id:foo.id content:foo</script>',
$html);
122 $c1 = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
123 $c2 = new \ILIAS\UI\Component\Test\JSTestComponent(
"foo");
127 $html = $renderer->renderAsync($c2);
128 $this->assertEquals(
'foo<script>id:foo.id content:foo</script>',
$html);
129 $html = $renderer->renderAsync($c1);
130 $this->assertEquals(
"foo",
$html);
131 $html = $renderer->renderAsync($c2);
132 $this->assertEquals(
'foo<script>id:foo.id content:foo</script>',
$html);
137 $c1 = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
142 $html = $renderer->renderAsync([$c1,$c1]);
143 $this->assertEquals(
'foofoo',
$html);
test_render_async_array()
test_passesContextsToComponentRendererLoader()
test_render_async_with_js_twice()
getDefaultRenderer(JavaScriptBinding $js_binding=null)
test_render_async_with_js()
test_render_async_no_js()
Provides common functionality for UI tests.
test_getRenderer_caching()
test_getRenderer_successfully()
Create styles array
The data for the language used.
test_withAdditionalContext_clones()