diff -u b/core/modules/system/src/Tests/Form/ElementTest.php b/core/modules/system/src/Tests/Form/ElementTest.php --- b/core/modules/system/src/Tests/Form/ElementTest.php +++ b/core/modules/system/src/Tests/Form/ElementTest.php @@ -164,8 +164,7 @@ * Tests form element error messages. */ public function testFormElementErrors() { - $edit = ['error_on_details' => '1']; - $this->drupalPostForm('form-test/group-container', $edit, 'Submit'); + $this->drupalPostForm('form_test/details-form', [], 'Submit'); $this->assertText('I am an error on the details element.'); } reverted: --- b/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupContainerForm.php +++ a/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupContainerForm.php @@ -39,26 +39,12 @@ '#type' => 'textfield', '#title' => 'Nest in details element', ); - $form['error_on_details'] = array( - '#type' => 'checkbox', - '#title' => 'Show error on details', - ); - $form['submit'] = array('#type' => 'submit', '#value' => 'Submit'); return $form; } /** * {@inheritdoc} */ - public function validateForm(array &$form, FormStateInterface $form_state) { - if ($form_state->getValue('error_on_details') == TRUE) { - $form_state->setErrorByName('meta', 'I am an error on the details element.'); - } - } - - /** - * {@inheritdoc} - */ public function submitForm(array &$form, FormStateInterface $form_state) { } only in patch2: unchanged: --- a/core/modules/system/tests/modules/form_test/form_test.routing.yml +++ b/core/modules/system/tests/modules/form_test/form_test.routing.yml @@ -394,6 +394,14 @@ form_test.button_class: requirements: _access: 'TRUE' +form_test.details_form: + path: '/form_test/details-form' + defaults: + _form: '\Drupal\form_test\Form\FormTestDetailsForm' + _title: 'Form details form test' + requirements: + _access: 'TRUE' + form_test.description_display: path: '/form_test/form-descriptions' defaults: only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestDetailsForm.php @@ -0,0 +1,52 @@ + 'details', + '#title' => 'Group element', + '#open' => TRUE, + '#group' => 'container', + ]; + $form['submit'] = ['#type' => 'submit', '#value' => 'Submit']; + return $form; + } + + /** + * {@inheritdoc} + */ + public function validateForm(array &$form, FormStateInterface $form_state) { + $form_state->setErrorByName('meta', 'I am an error on the details element.'); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + } + +}