ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 getExpectedStandardHTML ($content)
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. 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 15 of file PopoverTest.php.

Member Function Documentation

◆ getExpectedStandardHTML()

PopoverTest::getExpectedStandardHTML (   $content)
protected
Parameters
string$content
Returns
string

Definition at line 84 of file PopoverTest.php.

Referenced by test_render_standard().

85  {
86  return '<div class="il-standard-popover-content" style="display:none;" id="id_1">' . $content . '</div>';
87  }
+ Here is the caller graph for this function:

◆ getFactory()

PopoverTest::getFactory ( )

Definition at line 17 of file PopoverTest.php.

References Vendor\Package\$f, $factory, and legacy().

Referenced by test_render_async(), and test_render_standard().

18  {
19  $factory = new class extends NoUIFactory {
20  public function legacy($content)
21  {
22  $f = new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
23  return $f->legacy($content);
24  }
25  };
26  return $factory;
27  }
legacy()
Definition: legacy.php:3
$factory
Definition: metadata.php:58
+ 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 29 of file PopoverTest.php.

References $factory.

30  {
31  $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator);
32  $standard = $factory->standard(new DummyComponent());
33  $this->assertInstanceOf("ILIAS\\UI\\Component\\Popover\\Standard", $standard);
34  $listing = $factory->listing([new DummyComponent()]);
35  $this->assertInstanceOf("ILIAS\\UI\\Component\\Popover\\Listing", $listing);
36  }
$factory
Definition: metadata.php:58

◆ test_render_async()

PopoverTest::test_render_async ( )

Definition at line 73 of file PopoverTest.php.

References $factory, ILIAS_UI_TestBase\getDefaultRenderer(), getFactory(), and legacy().

74  {
75  $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator);
76  $popover = $factory->standard($this->getFactory()->legacy('myContent'))->withAsyncContentUrl('/blub/');
77  $this->assertEquals('', $this->getDefaultRenderer()->render($popover));
78  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
legacy()
Definition: legacy.php:3
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:

◆ test_render_listing()

PopoverTest::test_render_listing ( )

Definition at line 67 of file PopoverTest.php.

68  {
69  // TODO Listing not yet in framework core
70  $this->assertTrue(true);
71  }

◆ test_render_standard()

PopoverTest::test_render_standard ( )

Definition at line 58 of file PopoverTest.php.

References $factory, ILIAS_UI_TestBase\getDefaultRenderer(), getExpectedStandardHTML(), getFactory(), legacy(), and ILIAS_UI_TestBase\normalizeHTML().

59  {
60  $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator);
61  $popover = $factory->standard($this->getFactory()->legacy('myContent'));
62  $expected = $this->normalizeHTML($this->getExpectedStandardHTML('myContent'));
63  $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($popover));
64  $this->assertEquals($expected, $actual);
65  }
getExpectedStandardHTML($content)
Definition: PopoverTest.php:84
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
normalizeHTML($html)
Definition: Base.php:317
legacy()
Definition: legacy.php:3
$factory
Definition: metadata.php:58
+ 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 38 of file PopoverTest.php.

References $factory.

39  {
40  $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator);
41  $popover = $factory->standard(new DummyComponent());
42  $this->assertEquals(Popover::POS_AUTO, $popover->getPosition());
43  }
$factory
Definition: metadata.php:58

◆ test_with_position()

PopoverTest::test_with_position ( )

Definition at line 45 of file PopoverTest.php.

References $factory.

46  {
47  $factory = new I\Component\Popover\Factory(new I\Component\SignalGenerator);
48  $popover1 = $factory->standard(new DummyComponent());
49  $popover2 = $popover1->withVerticalPosition();
50  $popover3 = $popover2->withHorizontalPosition();
51  $this->assertEquals(Popover::POS_AUTO, $popover1->getPosition());
52  $this->assertEquals(Popover::POS_VERTICAL, $popover2->getPosition());
53  $this->assertEquals(Popover::POS_HORIZONTAL, $popover3->getPosition());
54  $this->assertEquals($popover1->getContent(), $popover2->getContent());
55  $this->assertEquals($popover1->getContent(), $popover3->getContent());
56  }
$factory
Definition: metadata.php:58

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