diff --git a/core/modules/system/src/Tests/Form/ElementTest.php b/core/modules/system/src/Tests/Form/ElementTest.php index 5247771..cf3e16e 100644 --- a/core/modules/system/src/Tests/Form/ElementTest.php +++ b/core/modules/system/src/Tests/Form/ElementTest.php @@ -102,6 +102,9 @@ function testRadiosChecked() { $elements = $this->xpath('//input[@name="radios" and @checked]'); $this->assertEqual(count($elements), 1); $this->assertIdentical((string) $elements[0]['value'], '0'); + $elements = $this->xpath('//input[@name="radios-string" and @checked]'); + $this->assertEqual(count($elements), 1); + $this->assertIdentical((string) $elements[0]['value'], 'bar'); } /** diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestRadiosCheckedForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestRadiosCheckedForm.php index 39b7b41..7be930b 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestRadiosCheckedForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestRadiosCheckedForm.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\form_test\Form\FormTestCheckboxesRadiosForm. + * Contains \Drupal\form_test\Form\FormTestRadiosCheckedForm. */ namespace Drupal\form_test\Form; @@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; /** - * Form constructor to test expansion of #type checkboxes and radios. + * Form constructor to test #default_value settings of radios. */ class FormTestRadiosCheckedForm extends FormBase { @@ -39,6 +39,18 @@ public function buildForm(array $form, FormStateInterface $form_state) { ), '#default_value' => 0 ); + $form['radios-string'] = array( + '#type' => 'radios', + '#title' => 'Radios', + '#options' => array( + 0 => 'Zero', + 'foo' => 'Foo', + 1 => 'One', + 'bar' => 'Bar - radios', + '>' => "Special Char", + ), + '#default_value' => 'bar', + ); $form['submit'] = array('#type' => 'submit', '#value' => 'Submit');