@@ -30,7 +30,7 @@ protected function setUp(): void
3030 */
3131 public function testTagWithAttribute (): void
3232 {
33- $ element = '<c-youtube src="RLdsCL4RDf8"></c-youtube > ' ;
33+ $ element = '<c-youtube src="RLdsCL4RDf8" / > ' ;
3434 $ result = $ this ->tagEngine ->parse ($ element );
3535 $ expected = <<<HTML
3636 <iframe width="560" height="315"
@@ -131,14 +131,52 @@ public function testTagWithInnerContent(): void
131131 $ this ->assertSame ($ expected , $ result );
132132 }
133133
134+ /**
135+ * Test inner content is passed down to the tag and can be outputted
136+ *
137+ * @return void
138+ */
139+ public function testTagWithInnerContentNested (): void
140+ {
141+ $ element = <<<HTML
142+ <div class="outer">
143+ <c-github>
144+ Outer Content
145+ <div class="inner">
146+ Inner Content
147+ <c-github>
148+ Inner Inner Content
149+ </c-github>
150+ </div>
151+ </c-github>
152+ </div>
153+ HTML ;
154+ $ result = $ this ->tagEngine ->parse ($ element );
155+ $ expected = <<<HTML
156+ <div class="outer">
157+ This is a render from a plugin tag
158+
159+ Outer Content
160+ <div class="inner">
161+ Inner Content
162+ <c-github>
163+ Inner Inner Content
164+
165+ </div>
166+ </c-github>
167+ </div>
168+ HTML ;
169+ $ this ->assertSame ($ expected , $ result );
170+ }
171+
134172 /**
135173 * Test tag variant and normal HTML
136174 *
137175 * @return void
138176 */
139177 public function testTagWithAttributeAndNormalHTML (): void
140178 {
141- $ element = '<c-youtube src="RLdsCL4RDf8"></c-youtube ><div>Test</div> ' ;
179+ $ element = '<c-youtube src="RLdsCL4RDf8" / ><div>Test</div> ' ;
142180 $ result = $ this ->tagEngine ->parse ($ element );
143181 $ expected = <<<HTML
144182 <iframe width="560" height="315"
@@ -189,7 +227,7 @@ public function testDisabledTag(): void
189227 */
190228 public function testOutputBuffered (): void
191229 {
192- $ element = '<c-github></c-github > ' ;
230+ $ element = '<c-github / > ' ;
193231 ob_start ();
194232 echo $ element ;
195233 $ result = $ this ->tagEngine ->parse ();
@@ -222,4 +260,42 @@ public function testWithDivWrapped(): void
222260HTML ;
223261 $ this ->assertSame ($ expected , $ result );
224262 }
263+
264+ /**
265+ * Test default class properties are rendered correctly
266+ *
267+ * @return void
268+ */
269+ public function testClassProperties (): void
270+ {
271+ $ element = '<c-class-properties src="RLdsCL4RDf8" /> ' ;
272+ $ result = $ this ->tagEngine ->parse ($ element );
273+ $ expected = <<<HTML
274+ <div class="default"></div>
275+ HTML ;
276+ $ this ->assertSame ($ expected , $ result );
277+ }
278+
279+ /**
280+ * Test class properties can be overwritten
281+ *
282+ * @return void
283+ */
284+ public function testClassPropertiesOverwritten (): void
285+ {
286+ $ element = '<c-class-properties src="RLdsCL4RDf8" test="overwritten" /> ' ;
287+ $ result = $ this ->tagEngine ->parse ($ element );
288+ $ expected = <<<HTML
289+ <div class="overwritten"></div>
290+ HTML ;
291+ $ this ->assertSame ($ expected , $ result );
292+ }
293+
294+ public function testUnknownTag (): void
295+ {
296+ $ element = '<c-unknown>Test inner</c-unknown> ' ;
297+ $ result = $ this ->tagEngine ->parse ($ element );
298+ $ expected = '<unknown>Test inner</unknown> ' ;
299+ $ this ->assertSame ($ expected , $ result );
300+ }
225301}
0 commit comments