From dcb5bb80aade1571fb28a4a57a0a65100c1252bd Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Wed, 28 Sep 2022 16:54:47 +0200 Subject: [PATCH] [Form] Removing self-closing slash from `` --- Resources/views/Form/form_div_layout.html.twig | 10 +++++----- Tests/Extension/AbstractBootstrap3LayoutTestCase.php | 4 ++-- Tests/Extension/AbstractLayoutTestCase.php | 7 +++++-- .../Extension/Fixtures/templates/form/theme.html.twig | 2 +- .../Fixtures/templates/form/theme_extends.html.twig | 2 +- .../Fixtures/templates/form/theme_use.html.twig | 2 +- Tests/Extension/FormExtensionBootstrap3LayoutTest.php | 2 +- Tests/Extension/FormExtensionBootstrap4LayoutTest.php | 2 +- Tests/Extension/FormExtensionBootstrap5LayoutTest.php | 2 +- Tests/Extension/FormExtensionDivLayoutTest.php | 2 +- 10 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Resources/views/Form/form_div_layout.html.twig b/Resources/views/Form/form_div_layout.html.twig index 02628b5a..29cfc2dc 100644 --- a/Resources/views/Form/form_div_layout.html.twig +++ b/Resources/views/Form/form_div_layout.html.twig @@ -14,7 +14,7 @@ {# Attribute "required" is not supported #} {%- set required = false -%} {%- endif -%} - + {%- endblock form_widget_simple -%} {%- block form_widget_compound -%} @@ -91,11 +91,11 @@ {%- endblock choice_widget_options -%} {%- block checkbox_widget -%} - + {%- endblock checkbox_widget -%} {%- block radio_widget -%} - + {%- endblock radio_widget -%} {%- block datetime_widget -%} @@ -402,7 +402,7 @@ {%- endif -%} {%- if form_method != method -%} - + {%- endif -%} {%- endblock form_start -%} @@ -440,7 +440,7 @@ {%- endif -%} {%- if form_method != method -%} - + {%- endif -%} {% endif -%} {% endblock form_rest %} diff --git a/Tests/Extension/AbstractBootstrap3LayoutTestCase.php b/Tests/Extension/AbstractBootstrap3LayoutTestCase.php index 7f4a77e2..0982b2e0 100644 --- a/Tests/Extension/AbstractBootstrap3LayoutTestCase.php +++ b/Tests/Extension/AbstractBootstrap3LayoutTestCase.php @@ -2772,7 +2772,7 @@ public function testWidgetAttributes() $html = $this->renderWidget($form->createView()); // compare plain HTML to check the whitespace - $this->assertSame('', $html); + $this->assertSame('', $html); } public function testWidgetAttributeNameRepeatedIfTrue() @@ -2784,7 +2784,7 @@ public function testWidgetAttributeNameRepeatedIfTrue() $html = $this->renderWidget($form->createView()); // foo="foo" - $this->assertSame('', $html); + $this->assertSame('', $html); } public function testButtonAttributes() diff --git a/Tests/Extension/AbstractLayoutTestCase.php b/Tests/Extension/AbstractLayoutTestCase.php index da7b0b86..d9bab6cd 100644 --- a/Tests/Extension/AbstractLayoutTestCase.php +++ b/Tests/Extension/AbstractLayoutTestCase.php @@ -72,6 +72,9 @@ protected function assertXpathNodeValue(\DOMElement $element, $expression, $node protected function assertMatchesXpath($html, $expression, $count = 1) { $dom = new \DOMDocument('UTF-8'); + + $html = preg_replace('/(]+)(?/', '$1/>', $html); + try { // Wrap in node so we can load HTML with multiple tags at // the top level @@ -2511,7 +2514,7 @@ public function testWidgetAttributes() $html = $this->renderWidget($form->createView()); // compare plain HTML to check the whitespace - $this->assertSame('', $html); + $this->assertSame('', $html); } public function testWidgetAttributeNameRepeatedIfTrue() @@ -2523,7 +2526,7 @@ public function testWidgetAttributeNameRepeatedIfTrue() $html = $this->renderWidget($form->createView()); // foo="foo" - $this->assertSame('', $html); + $this->assertSame('', $html); } public function testWidgetAttributeHiddenIfFalse() diff --git a/Tests/Extension/Fixtures/templates/form/theme.html.twig b/Tests/Extension/Fixtures/templates/form/theme.html.twig index e8816be9..3ec513a4 100644 --- a/Tests/Extension/Fixtures/templates/form/theme.html.twig +++ b/Tests/Extension/Fixtures/templates/form/theme.html.twig @@ -1,4 +1,4 @@ {% block form_widget_simple %} {%- set type = type|default('text') -%} - + {%- endblock form_widget_simple %} diff --git a/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig b/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig index 501b555e..2b9118a2 100644 --- a/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig +++ b/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig @@ -2,5 +2,5 @@ {% block form_widget_simple %} {%- set type = type|default('text') -%} - + {%- endblock form_widget_simple %} diff --git a/Tests/Extension/Fixtures/templates/form/theme_use.html.twig b/Tests/Extension/Fixtures/templates/form/theme_use.html.twig index 37150734..e05de5ac 100644 --- a/Tests/Extension/Fixtures/templates/form/theme_use.html.twig +++ b/Tests/Extension/Fixtures/templates/form/theme_use.html.twig @@ -2,5 +2,5 @@ {% block form_widget_simple %} {%- set type = type|default('text') -%} - + {%- endblock form_widget_simple %} diff --git a/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/Tests/Extension/FormExtensionBootstrap3LayoutTest.php index 2e7ade2c..bb0f5687 100644 --- a/Tests/Extension/FormExtensionBootstrap3LayoutTest.php +++ b/Tests/Extension/FormExtensionBootstrap3LayoutTest.php @@ -97,7 +97,7 @@ public function testMoneyWidgetInIso() $this->assertSame(<<<'HTML'
-
+ HTML , trim($this->renderWidget($view))); } diff --git a/Tests/Extension/FormExtensionBootstrap4LayoutTest.php b/Tests/Extension/FormExtensionBootstrap4LayoutTest.php index ccf9d65c..3aecccf1 100644 --- a/Tests/Extension/FormExtensionBootstrap4LayoutTest.php +++ b/Tests/Extension/FormExtensionBootstrap4LayoutTest.php @@ -102,7 +102,7 @@ public function testMoneyWidgetInIso() $this->assertSame(<<<'HTML'
-
+ HTML , trim($this->renderWidget($view))); } diff --git a/Tests/Extension/FormExtensionBootstrap5LayoutTest.php b/Tests/Extension/FormExtensionBootstrap5LayoutTest.php index 63d2dfa4..66f6bbb9 100644 --- a/Tests/Extension/FormExtensionBootstrap5LayoutTest.php +++ b/Tests/Extension/FormExtensionBootstrap5LayoutTest.php @@ -101,7 +101,7 @@ public function testMoneyWidgetInIso() ->createView(); self::assertSame(<<<'HTML' -
+
HTML , trim($this->renderWidget($view))); } diff --git a/Tests/Extension/FormExtensionDivLayoutTest.php b/Tests/Extension/FormExtensionDivLayoutTest.php index f18c03ce..c9dec6e2 100644 --- a/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/Tests/Extension/FormExtensionDivLayoutTest.php @@ -184,7 +184,7 @@ public function testMoneyWidgetInIso() ->createView() ; - $this->assertSame('€ ', $this->renderWidget($view)); + $this->assertSame('€ ', $this->renderWidget($view)); } public function testHelpAttr()