ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PopoverTest Class Reference

Class PopoverTest. More...

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

Public Member Functions

 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 ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 getExpectedStandardHTML ($content)
 

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 14 of file PopoverTest.php.

Member Function Documentation

◆ getExpectedStandardHTML()

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

Definition at line 71 of file PopoverTest.php.

Referenced by test_render_standard().

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

◆ test_implements_interface()

PopoverTest::test_implements_interface ( )

Definition at line 16 of file PopoverTest.php.

References $factory.

17  {
18  $factory = new \ILIAS\UI\Implementation\Factory();
19  $standard = $factory->popover()->standard(new DummyComponent());
20  $this->assertInstanceOf("ILIAS\\UI\\Component\\Popover\\Standard", $standard);
21  $listing = $factory->popover()->listing([new DummyComponent()]);
22  $this->assertInstanceOf("ILIAS\\UI\\Component\\Popover\\Listing", $listing);
23  }
$factory
Definition: metadata.php:47

◆ test_render_async()

PopoverTest::test_render_async ( )

Definition at line 60 of file PopoverTest.php.

References $factory, and ILIAS_UI_TestBase\getDefaultRenderer().

61  {
62  $factory = new \ILIAS\UI\Implementation\Factory();
63  $popover = $factory->popover()->standard($factory->legacy('myContent'))->withAsyncContentUrl('/blub/');
64  $this->assertEquals('', $this->getDefaultRenderer()->render($popover));
65  }
$factory
Definition: metadata.php:47
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
+ Here is the call graph for this function:

◆ test_render_listing()

PopoverTest::test_render_listing ( )

Definition at line 54 of file PopoverTest.php.

55  {
56  // TODO Listing not yet in framework core
57  $this->assertTrue(true);
58  }

◆ test_render_standard()

PopoverTest::test_render_standard ( )

Definition at line 45 of file PopoverTest.php.

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

46  {
47  $factory = new \ILIAS\UI\Implementation\Factory();
48  $popover = $factory->popover()->standard($factory->legacy('myContent'));
49  $expected = $this->normalizeHTML($this->getExpectedStandardHTML('myContent'));
50  $actual = $this->normalizeHTML($this->getDefaultRenderer()->render($popover));
51  $this->assertEquals($expected, $actual);
52  }
$factory
Definition: metadata.php:47
getExpectedStandardHTML($content)
Definition: PopoverTest.php:71
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: Base.php:243
+ 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 25 of file PopoverTest.php.

References $factory.

26  {
27  $factory = new \ILIAS\UI\Implementation\Factory();
28  $popover = $factory->popover()->standard(new DummyComponent());
29  $this->assertEquals(Popover::POS_AUTO, $popover->getPosition());
30  }
$factory
Definition: metadata.php:47

◆ test_with_position()

PopoverTest::test_with_position ( )

Definition at line 32 of file PopoverTest.php.

References $factory.

33  {
34  $factory = new \ILIAS\UI\Implementation\Factory();
35  $popover1 = $factory->popover()->standard(new DummyComponent());
36  $popover2 = $popover1->withVerticalPosition();
37  $popover3 = $popover2->withHorizontalPosition();
38  $this->assertEquals(Popover::POS_AUTO, $popover1->getPosition());
39  $this->assertEquals(Popover::POS_VERTICAL, $popover2->getPosition());
40  $this->assertEquals(Popover::POS_HORIZONTAL, $popover3->getPosition());
41  $this->assertEquals($popover1->getContent(), $popover2->getContent());
42  $this->assertEquals($popover1->getContent(), $popover3->getContent());
43  }
$factory
Definition: metadata.php:47

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