Skip to content

Commit bd0bd5f

Browse files
Mathieu Lechatxabbuh
authored andcommitted
[Form] Changed UrlType input type to text when default_protocol is not null
1 parent 1b8a0b7 commit bd0bd5f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Tests/Extension/AbstractBootstrap3LayoutTest.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,13 +2385,29 @@ public function testTimezoneWithPlaceholder()
23852385
);
23862386
}
23872387

2388-
public function testUrl()
2388+
public function testUrlWithDefaultProtocol()
23892389
{
23902390
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
2391-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url);
2391+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => 'http']);
23922392

23932393
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
23942394
'/input
2395+
[@type="text"]
2396+
[@name="name"]
2397+
[@class="my&class form-control"]
2398+
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
2399+
[@inputmode="url"]
2400+
'
2401+
);
2402+
}
2403+
2404+
public function testUrlWithoutDefaultProtocol()
2405+
{
2406+
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
2407+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => null]);
2408+
2409+
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
2410+
'/input
23952411
[@type="url"]
23962412
[@name="name"]
23972413
[@class="my&class form-control"]

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symfony/asset": "~2.8|~3.0|~4.0",
2424
"symfony/dependency-injection": "~2.8|~3.0|~4.0",
2525
"symfony/finder": "~2.8|~3.0|~4.0",
26-
"symfony/form": "^3.4.16|^4.1.5",
26+
"symfony/form": "^3.4.22|~4.1.11|^4.2.3",
2727
"symfony/http-foundation": "^3.3.11|~4.0",
2828
"symfony/http-kernel": "~3.2|~4.0",
2929
"symfony/polyfill-intl-icu": "~1.0",

0 commit comments

Comments
 (0)