Skip to content
Snippets Groups Projects
Commit e05b806d authored by catch's avatar catch
Browse files

Issue #2787025 by vidorado, vivek panicker, danmer, dfletcher, smustgrave:...

Issue #2787025 by vidorado, vivek panicker, danmer, dfletcher, smustgrave: Setting #resizable on a textarea has no effect
parent f3b0c8db
Branches
Tags
4 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #439771 passed with warnings
Pipeline: drupal

#439772

    ......@@ -391,7 +391,11 @@ function template_preprocess_textarea(&$variables): void {
    $variables['wrapper_attributes'] = new Attribute();
    $variables['attributes'] = new Attribute($element['#attributes']);
    $variables['value'] = $element['#value'];
    $variables['resizable'] = !empty($element['#resizable']) ? $element['#resizable'] : NULL;
    $resizable = !empty($element['#resizable']) ? $element['#resizable'] : NULL;
    $variables['resizable'] = $resizable;
    if ($resizable) {
    $variables['attributes']->addClass('resize-' . $resizable);
    }
    $variables['required'] = !empty($element['#required']) ? $element['#required'] : NULL;
    }
    ......
    ......@@ -574,6 +574,15 @@ form_test.incorrect_config_target:
    requirements:
    _access: 'TRUE'
    form_test.textarea:
    path: '/form-test/textarea'
    defaults:
    _form: '\Drupal\form_test\Form\FormTestTextareaForm'
    options:
    _admin_route: TRUE
    requirements:
    _access: 'TRUE'
    form_test.recipe_input:
    path: '/form-test/recipe-input'
    defaults:
    ......
    <?php
    declare(strict_types=1);
    namespace Drupal\form_test\Form;
    use Drupal\Core\Form\FormBase;
    use Drupal\Core\Form\FormStateInterface;
    use Symfony\Component\HttpFoundation\JsonResponse;
    /**
    * Form for testing textarea.
    *
    * @internal
    */
    class FormTestTextareaForm extends FormBase {
    /**
    * {@inheritdoc}
    */
    public function getFormId() {
    return '_test_textarea_form';
    }
    /**
    * {@inheritdoc}
    */
    public function buildForm(array $form, FormStateInterface $form_state) {
    foreach (['vertical', 'horizontal', 'both', 'none'] as $resizableMode) {
    $id = 'textarea_resizable_' . $resizableMode;
    $form[$id] = [
    '#type' => 'textarea',
    '#title' => $id,
    '#resizable' => $resizableMode,
    ];
    }
    $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this->t('Submit'),
    ];
    return $form;
    }
    /**
    * {@inheritdoc}
    */
    public function submitForm(array &$form, FormStateInterface $form_state): void {
    $form_state->setResponse(new JsonResponse($form_state->getValues()));
    }
    }
    <?php
    declare(strict_types=1);
    namespace Drupal\Tests\system\Functional\Form;
    use Drupal\Tests\BrowserTestBase;
    /**
    * Tests the form API textarea element.
    *
    * @group Form
    */
    class TextareaTest extends BrowserTestBase {
    /**
    * {@inheritdoc}
    */
    protected static $modules = ['form_test'];
    /**
    * {@inheritdoc}
    */
    protected $defaultTheme = 'stark';
    /**
    * Tests the textarea element #resizable property.
    */
    public function testFormTextareaResizable(): void {
    $this->drupalGet('form-test/textarea');
    $this->assertNotEmpty($this->cssSelect('#edit-textarea-resizable-vertical.resize-vertical'));
    $this->assertNotEmpty($this->cssSelect('#edit-textarea-resizable-horizontal.resize-horizontal'));
    $this->assertNotEmpty($this->cssSelect('#edit-textarea-resizable-both.resize-both'));
    $this->assertNotEmpty($this->cssSelect('#edit-textarea-resizable-none.resize-none'));
    }
    }
    ......@@ -142,8 +142,8 @@ protected function testAnonymous(): void {
    ],
    'CacheSetCount' => 45,
    'CacheDeleteCount' => 0,
    'CacheTagChecksumCount' => 37,
    'CacheTagIsValidCount' => 42,
    'CacheTagChecksumCount' => 38,
    'CacheTagIsValidCount' => 43,
    'CacheTagInvalidationCount' => 0,
    'CacheTagLookupQueryCount' => 21,
    'CacheTagGroupedLookups' => [
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment