diff --git a/src/Tempest/View/src/Components/XForm.php b/src/Tempest/View/src/Components/Form.php similarity index 92% rename from src/Tempest/View/src/Components/XForm.php rename to src/Tempest/View/src/Components/Form.php index 73a6cb93f..24ab6bb7c 100644 --- a/src/Tempest/View/src/Components/XForm.php +++ b/src/Tempest/View/src/Components/Form.php @@ -7,7 +7,7 @@ use Tempest\View\Elements\ViewComponentElement; use Tempest\View\ViewComponent; -final readonly class XForm implements ViewComponent +final readonly class Form implements ViewComponent { public static function getName(): string { diff --git a/src/Tempest/View/src/Components/XInput.php b/src/Tempest/View/src/Components/Input.php similarity index 97% rename from src/Tempest/View/src/Components/XInput.php rename to src/Tempest/View/src/Components/Input.php index 5340a16ac..75b9ef9f6 100644 --- a/src/Tempest/View/src/Components/XInput.php +++ b/src/Tempest/View/src/Components/Input.php @@ -9,7 +9,7 @@ use Tempest\View\Elements\ViewComponentElement; use Tempest\View\ViewComponent; -final readonly class XInput implements ViewComponent +final readonly class Input implements ViewComponent { public function __construct( private Session $session, diff --git a/src/Tempest/View/src/Components/XSubmit.php b/src/Tempest/View/src/Components/Submit.php similarity index 89% rename from src/Tempest/View/src/Components/XSubmit.php rename to src/Tempest/View/src/Components/Submit.php index 2a4f53df4..a927757c6 100644 --- a/src/Tempest/View/src/Components/XSubmit.php +++ b/src/Tempest/View/src/Components/Submit.php @@ -7,7 +7,7 @@ use Tempest\View\Elements\ViewComponentElement; use Tempest\View\ViewComponent; -final readonly class XSubmit implements ViewComponent +final readonly class Submit implements ViewComponent { public static function getName(): string { diff --git a/src/Tempest/View/src/Elements/ElementFactory.php b/src/Tempest/View/src/Elements/ElementFactory.php index 5aaccebd5..4d30e4ee0 100644 --- a/src/Tempest/View/src/Elements/ElementFactory.php +++ b/src/Tempest/View/src/Elements/ElementFactory.php @@ -63,11 +63,8 @@ private function makeElement(DOMNode $node, ?Element $parent): ?Element if (! $node instanceof DOMElement || $node->tagName === 'pre' - || $node->tagName === 'code' - || $node->tagName === 'x-raw' - ) { + || $node->tagName === 'code') { $content = ''; - foreach ($node->childNodes as $child) { $content .= $node->ownerDocument->saveHTML($child); } @@ -85,9 +82,9 @@ private function makeElement(DOMNode $node, ?Element $parent): ?Element } $element = new ViewComponentElement( - compiler: $this->compiler, - viewComponent: $viewComponentClass, - attributes: $attributes, + $this->compiler, + $viewComponentClass, + $attributes, ); } elseif ($node->tagName === 'x-slot') { $element = new SlotElement( diff --git a/src/Tempest/View/src/Elements/RawElement.php b/src/Tempest/View/src/Elements/RawElement.php index b01f0caea..c2b2ef923 100644 --- a/src/Tempest/View/src/Elements/RawElement.php +++ b/src/Tempest/View/src/Elements/RawElement.php @@ -21,7 +21,7 @@ public function __construct( public function compile(): string { - if ($this->tag === null || $this->tag === 'x-raw') { + if ($this->tag === null) { return $this->content; } diff --git a/tests/Integration/View/TempestViewRendererTest.php b/tests/Integration/View/TempestViewRendererTest.php index 300b29b2e..722912f42 100644 --- a/tests/Integration/View/TempestViewRendererTest.php +++ b/tests/Integration/View/TempestViewRendererTest.php @@ -416,11 +416,4 @@ public function test_view_component_with_multiple_attributes(): void $html = $this->render(view('')); $this->assertStringEqualsStringIgnoringLineEndings($expected, $html); } - - public function test_raw_component(): void - { - $html = $this->render('
{{ $bar }}
'); - - $this->assertStringEqualsStringIgnoringLineEndings('
{{ $bar }}
', $html); - } } diff --git a/tests/Integration/View/ViewComponentDiscoveryTest.php b/tests/Integration/View/ViewComponentDiscoveryTest.php index 3494a1777..5bdc2fd35 100644 --- a/tests/Integration/View/ViewComponentDiscoveryTest.php +++ b/tests/Integration/View/ViewComponentDiscoveryTest.php @@ -4,7 +4,7 @@ namespace Tests\Tempest\Integration\View; -use Tempest\View\Components\XInput; +use Tempest\View\Components\Input; use Tempest\View\Exceptions\DuplicateViewComponent; use Tempest\View\ViewComponentDiscovery; use Tests\Tempest\Integration\FrameworkIntegrationTestCase; @@ -22,7 +22,7 @@ public function test_duplicates(): void $discovery->discoverPath(__DIR__ . '/duplicateComponent.view.php'); } catch (DuplicateViewComponent $duplicateViewComponent) { $this->assertStringContainsString(__DIR__ . '/duplicateComponent.view.php', $duplicateViewComponent->getMessage()); - $this->assertStringContainsString(XInput::class, $duplicateViewComponent->getMessage()); + $this->assertStringContainsString(Input::class, $duplicateViewComponent->getMessage()); $this->assertStringContainsString('x-input', $duplicateViewComponent->getMessage()); } }