From 8915191baee49b0b363fc333ea068d56a9b0086b Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Mon, 20 Jun 2022 00:23:57 +0100 Subject: [PATCH] Issue #1645328 by Liam Morland, darvanen, shravan sonkar, andregp, mandar.harkare, jhedstrom, sun: Add test to ensure fieldset allows any non-empty-string #title --- .../modules/form_test/src/Form/FormTestGroupFieldsetForm.php | 4 ++++ core/modules/system/tests/src/Functional/Form/ElementTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php index b37d6bba44b4..5d7d79b051d5 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php @@ -37,6 +37,10 @@ public function buildForm(array $form, FormStateInterface $form_state, $required '#type' => 'textfield', '#title' => 'Nest in container element', ]; + $form['fieldset_zero'] = [ + '#type' => 'fieldset', + '#title' => 0, + ]; return $form; } diff --git a/core/modules/system/tests/src/Functional/Form/ElementTest.php b/core/modules/system/tests/src/Functional/Form/ElementTest.php index dc11b2609360..afd264577a87 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementTest.php @@ -144,6 +144,7 @@ public function testGroupElements() { $this->assertSession()->elementsCount('xpath', '//div[@id="edit-container"]//div[@class="details-wrapper"]//label', 1); $this->drupalGet('form-test/group-fieldset'); $this->assertSession()->elementsCount('xpath', '//fieldset[@id="edit-fieldset"]//div[@id="edit-meta"]//label', 1); + $this->assertSession()->elementTextEquals('xpath', '//fieldset[@id="edit-fieldset-zero"]//legend', '0'); $this->drupalGet('form-test/group-vertical-tabs'); $this->assertSession()->elementsCount('xpath', '//div[@data-vertical-tabs-panes]//details[@id="edit-meta"]//label', 1); $this->assertSession()->elementsCount('xpath', '//div[@data-vertical-tabs-panes]//details[@id="edit-meta-2"]//label', 1); -- GitLab