ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
PopoverTest Class Reference

Class PopoverTest. More...

+ Inheritance diagram for PopoverTest:
+ Collaboration diagram for PopoverTest:

Public Member Functions

 getFactory ()
 
 test_implements_interface ()
 
 test_that_position_is_auto_by_default ()
 
 test_with_position ()
 
 test_render_standard ()
 
 test_render_listing ()
 
 test_render_async ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 getExpectedStandardHTML (string $content)
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Class PopoverTest.

Tests on the Popover component implementation

Author
Stefan Wanzenried sw@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 34 of file PopoverTest.php.

Member Function Documentation

◆ getExpectedStandardHTML()

PopoverTest::getExpectedStandardHTML ( string  $content)
protected

Definition at line 98 of file PopoverTest.php.

98 : string
99 {
100 return '<div class="il-standard-popover-content" style="display:none;" id="id_1">' . $content . '</div>';
101 }

Referenced by test_render_standard().

+ Here is the caller graph for this function:

◆ getFactory()

PopoverTest::getFactory ( )

Definition at line 36 of file PopoverTest.php.

37 {
38 return new class () extends NoUIFactory {
39 public function legacy(string $content): I\Component\Legacy\Legacy
40 {
41 $f = new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
42 return $f->legacy($content);
43 }
44 };
45 }
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...

References Vendor\Package\$f, and ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

Referenced by test_render_async(), and test_render_standard().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_implements_interface()

PopoverTest::test_implements_interface ( )

Definition at line 47 of file PopoverTest.php.

47 : void
48 {
49 $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator());
50 $standard = $factory->standard(new DummyComponent());
51 $this->assertInstanceOf("ILIAS\\UI\\Component\\Popover\\Standard", $standard);
52 $listing = $factory->listing([new DummyComponent()]);
53 $this->assertInstanceOf("ILIAS\\UI\\Component\\Popover\\Listing", $listing);
54 }
$factory
Definition: metadata.php:75

References $factory.

◆ test_render_async()

PopoverTest::test_render_async ( )

Definition at line 91 of file PopoverTest.php.

91 : void
92 {
93 $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator());
94 $popover = $factory->standard($this->getFactory()->legacy('myContent'))->withAsyncContentUrl('/blub/');
95 $this->assertEquals('', $this->getDefaultRenderer()->render($popover));
96 }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References $factory, ILIAS_UI_TestBase\getDefaultRenderer(), getFactory(), and ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

+ Here is the call graph for this function:

◆ test_render_listing()

PopoverTest::test_render_listing ( )

Definition at line 85 of file PopoverTest.php.

85 : void
86 {
87 // TODO Listing not yet in framework core
88 $this->assertTrue(true);
89 }

◆ test_render_standard()

PopoverTest::test_render_standard ( )

Definition at line 76 of file PopoverTest.php.

76 : void
77 {
78 $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator());
79 $popover = $factory->standard($this->getFactory()->legacy('myContent'));
80 $expected = $this->normalizeHTML($this->getExpectedStandardHTML('myContent'));
81 $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($popover));
82 $this->assertEquals($expected, $actual);
83 }
normalizeHTML(string $html)
Definition: Base.php:422
getExpectedStandardHTML(string $content)
Definition: PopoverTest.php:98

References $factory, ILIAS_UI_TestBase\getDefaultRenderer(), getExpectedStandardHTML(), getFactory(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), and ILIAS_UI_TestBase\normalizeHTML().

+ Here is the call graph for this function:

◆ test_that_position_is_auto_by_default()

PopoverTest::test_that_position_is_auto_by_default ( )

Definition at line 56 of file PopoverTest.php.

56 : void
57 {
58 $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator());
59 $popover = $factory->standard(new DummyComponent());
60 $this->assertEquals(Popover::POS_AUTO, $popover->getPosition());
61 }

References $factory.

◆ test_with_position()

PopoverTest::test_with_position ( )

Definition at line 63 of file PopoverTest.php.

63 : void
64 {
65 $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator());
66 $popover1 = $factory->standard(new DummyComponent());
67 $popover2 = $popover1->withVerticalPosition();
68 $popover3 = $popover2->withHorizontalPosition();
69 $this->assertEquals(Popover::POS_AUTO, $popover1->getPosition());
70 $this->assertEquals(Popover::POS_VERTICAL, $popover2->getPosition());
71 $this->assertEquals(Popover::POS_HORIZONTAL, $popover3->getPosition());
72 $this->assertEquals($popover1->getContent(), $popover2->getContent());
73 $this->assertEquals($popover1->getContent(), $popover3->getContent());
74 }

References $factory.


The documentation for this class was generated from the following file: