From dd1ee94a1e9ae0f8a7832d7670cbc33825cfdd93 Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Fri, 11 Apr 2025 17:14:17 -0400 Subject: [PATCH 1/3] Forgot to change these. --- tests/Tags/Form/FormCreateCustomDriverTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Tags/Form/FormCreateCustomDriverTest.php b/tests/Tags/Form/FormCreateCustomDriverTest.php index b652ae7ea6..969b015da9 100644 --- a/tests/Tags/Form/FormCreateCustomDriverTest.php +++ b/tests/Tags/Form/FormCreateCustomDriverTest.php @@ -57,9 +57,9 @@ public function custom_driver_can_add_to_renderable_field_data() { $output = $this->tag(<<<'EOT' {{ form:contact js="custom_driver" }} - {{ fields }} + {{ form:fields }} - {{ /fields }} + {{ /form:fields }} {{ /form:contact }} EOT ); @@ -74,9 +74,9 @@ public function custom_driver_can_add_to_renderable_field_attributes() { $output = $this->normalizeHtml($this->tag(<<<'EOT' {{ form:contact js="custom_driver" }} - {{ fields }} + {{ form:fields }} {{ field }} - {{ /fields }} + {{ /form:fields }} {{ /form:contact }} EOT )); @@ -100,9 +100,9 @@ public function custom_driver_get_show_field_js_in_dynamic_fields_array() { $output = $this->tag(<<<'EOT' {{ form:contact js="custom_driver" }} - {{ fields }} + {{ form:fields }} - {{ /fields }} + {{ /form:fields }} {{ /form:contact }} EOT ); From 834593791a2f3bb757296e5160bea31e41daa134 Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Fri, 11 Apr 2025 17:38:17 -0400 Subject: [PATCH 2/3] Add test coverage for escaping show_field JS with blade component. --- tests/Tags/Form/FormCreateAlpineTest.php | 29 ++++++++++++++++++++++++ tests/Tags/Form/FormTestCase.php | 10 ++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tests/Tags/Form/FormCreateAlpineTest.php b/tests/Tags/Form/FormCreateAlpineTest.php index 194433698a..11d12bce63 100644 --- a/tests/Tags/Form/FormCreateAlpineTest.php +++ b/tests/Tags/Form/FormCreateAlpineTest.php @@ -809,6 +809,35 @@ public function it_merges_any_x_data_passed_to_the_tag() $this->assertStringContainsString($expected, $output); } + #[Test] + public function it_properly_escapes_show_field_js_in_blade() + { + $output = $this->blade(<<<'EOT' + + + + + + @if ($field['handle'] === 'message') + + @endif + + +EOT + ); + + preg_match_all('/