Skip to content

Commit 6906714

Browse files
author
matheo
committed
Add test for component in nested directory
1 parent 7f4e71e commit 6906714

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<twig:Form:SubmitButton label='Submit'/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% props label, primary = true %}
2+
3+
<button type="submit" class="{{ primary ? 'primary' : 'secondary' }}">
4+
{{ label }}
5+
</button>

src/TwigComponent/tests/Integration/ComponentExtensionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ public function testRenderAnonymousComponentOverwriteProps(): void
174174
$this->assertStringContainsString('class="secondary"', $output);
175175
}
176176

177+
public function testRenderAnonymousComponentInNestedDirectory(): void
178+
{
179+
$output = self::getContainer()->get(Environment::class)->render('anonymous_component_nested_directory.html.twig');
180+
181+
$this->assertStringContainsString('Submit', $output);
182+
$this->assertStringContainsString('class="primary"', $output);
183+
}
184+
177185
private function renderComponent(string $name, array $data = []): string
178186
{
179187
return self::getContainer()->get(Environment::class)->render('render_component.html.twig', [

0 commit comments

Comments
 (0)