ILIAS  release_7 Revision v7.30-3-g800a261c036
BylineNodeTest Class Reference

Tests for the SimpleNode. More...

+ Inheritance diagram for BylineNodeTest:
+ Collaboration diagram for BylineNodeTest:

Public Member Functions

 setUp ()
 
 testCreateBylineNode ()
 
 testRendering ()
 
 testRenderingWithIcon ()
 
 testRenderingWithAsync ()
 
 testRenderingExpanded ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Private Attributes

 $node_factory
 
 $icon
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Tests for the SimpleNode.

Definition at line 18 of file BylineNodeTest.php.

Member Function Documentation

◆ setUp()

BylineNodeTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 30 of file BylineNodeTest.php.

30 : void
31 {
32 $this->node_factory = new I\Tree\Node\Factory();
33 $icon_factory = new I\Symbol\Icon\Factory();
34 $this->icon = $icon_factory->standard("", '');
35 }

◆ testCreateBylineNode()

BylineNodeTest::testCreateBylineNode ( )

Definition at line 37 of file BylineNodeTest.php.

38 {
39 $node = $this->node_factory->bylined('My Label', 'This is my byline', $this->icon);
40 $this->assertEquals('My Label', $node->getLabel());
41 $this->assertEquals('This is my byline', $node->getByline());
42 $this->assertEquals($this->icon, $node->getIcon());
43 }

◆ testRendering()

BylineNodeTest::testRendering ( )

Definition at line 45 of file BylineNodeTest.php.

46 {
47 $node = $this->node_factory->bylined('My Label', 'This is my byline');
48
49 $r = $this->getDefaultRenderer();
50 $html = $r->render($node);
51
52 $expected = <<<EOT
53 <li id="" class="il-tree-node node-simple" role="treeitem">
54 <span class="node-line">
55 <span class="node-label">My Label</span>
56 <span class="node-byline">This is my byline</span>
57 </span>
58 </li>
59EOT;
60
61 $this->assertEquals(
62 $this->brutallyTrimHTML($expected),
63 $this->brutallyTrimHTML($html)
64 );
65 }
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingExpanded()

BylineNodeTest::testRenderingExpanded ( )

Definition at line 119 of file BylineNodeTest.php.

120 {
121 $node = $this->node_factory->bylined('My Label', 'This is my byline');
122 $node = $node->withAsyncURL('something.de')->withExpanded(true);
123
124 $r = $this->getDefaultRenderer();
125 $html = $r->render($node);
126
127 $expected = <<<EOT
128 <li id=""
129 class="il-tree-node node-simple expandable"
130 role="treeitem" aria-expanded="true"
131 data-async_url="something.de" data-async_loaded="false">
132 <span class="node-line">
133 <span class="node-label">My Label</span>
134 <span class="node-byline">This is my byline</span>
135 </span>
136 <ul role="group"></ul>
137 </li>
138EOT;
139
140 $this->assertEquals(
141 $this->brutallyTrimHTML($expected),
142 $this->brutallyTrimHTML($html)
143 );
144 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithAsync()

BylineNodeTest::testRenderingWithAsync ( )

Definition at line 92 of file BylineNodeTest.php.

93 {
94 $node = $this->node_factory->bylined('My Label', 'This is my byline');
95 $node = $node->withAsyncURL('something.de');
96
97 $r = $this->getDefaultRenderer();
98 $html = $r->render($node);
99
100 $expected = <<<EOT
101 <li id=""
102 class="il-tree-node node-simple expandable"
103 role="treeitem" aria-expanded="false"
104 data-async_url="something.de" data-async_loaded="false">
105 <span class="node-line">
106 <span class="node-label">My Label</span>
107 <span class="node-byline">This is my byline</span>
108 </span>
109 <ul role="group"></ul>
110 </li>
111EOT;
112
113 $this->assertEquals(
114 $this->brutallyTrimHTML($expected),
115 $this->brutallyTrimHTML($html)
116 );
117 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithIcon()

BylineNodeTest::testRenderingWithIcon ( )

Definition at line 67 of file BylineNodeTest.php.

68 {
69 $node = $this->node_factory->bylined('My Label', 'This is my byline', $this->icon);
70
71 $r = $this->getDefaultRenderer();
72 $html = $r->render($node);
73
74 $expected = <<<EOT
75 <li id="" class="il-tree-node node-simple" role="treeitem">
76 <span class="node-line">
77 <span class="node-label">
78 <img class="icon small" src="./templates/default/images/icon_default.svg" alt=""/>
79 My Label
80 </span>
81 <span class="node-byline">This is my byline</span>
82 </span>
83 </li>
84EOT;
85
86 $this->assertEquals(
87 $this->brutallyTrimHTML($expected),
88 $this->brutallyTrimHTML($html)
89 );
90 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

Field Documentation

◆ $icon

BylineNodeTest::$icon
private

Definition at line 28 of file BylineNodeTest.php.

◆ $node_factory

BylineNodeTest::$node_factory
private

Definition at line 23 of file BylineNodeTest.php.


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