bug #39099 [Form] ignore the pattern attribute for textareas (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[Form] ignore the pattern attribute for textareas

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #39066
| License       | MIT
| Doc PR        |

Commits
-------

e7698e7434 ignore the pattern attribute for textareas
This commit is contained in:
Fabien Potencier 2020-11-27 07:20:55 +01:00
commit 1fb80e7cf0
4 changed files with 4 additions and 3 deletions

View File

@ -2379,7 +2379,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/textarea
[@name="name"]
[@pattern="foo"]
[not(@pattern)]
[@class="my&class form-control"]
[.="foo&bar"]
'

View File

@ -26,7 +26,7 @@
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
"symfony/error-handler": "^4.4|^5.0",
"symfony/finder": "^3.4|^4.0|^5.0",
"symfony/form": "^4.3.5",
"symfony/form": "^4.4.17",
"symfony/http-foundation": "^4.3|^5.0",
"symfony/http-kernel": "^4.4",
"symfony/mime": "^4.3|^5.0",

View File

@ -23,6 +23,7 @@ class TextareaType extends AbstractType
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['pattern'] = null;
unset($view->vars['attr']['pattern']);
}
/**

View File

@ -2068,7 +2068,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
$this->assertWidgetMatchesXpath($form->createView(), [],
'/textarea
[@name="name"]
[@pattern="foo"]
[not(@pattern)]
[.="foo&bar"]
'
);